text: Q:
  
  STL std::map operator[] when on the right side of assignment
  
  I am aware that the map dereference operator[] is not const and can modify the map. However, I was wondering what happens when the operator is on the right side. For instance:
  std::map<int, int> a;
  int b = a[0];
  
  Since a will not have the 0 entry will this create a new entry in the map with the key 0?
  
  A:
  
  Regarding operator[]:
  
  Returns a reference to the value that is mapped to a key equivalent to key, performing an insertion if such key does not already exist.
  
  From here, emphasis mine.
  This is easy to test, too.
  std::map<int, int> a;
  std::cout << a.size(); //0
  int b = a[0];
  std::cout << a.size(); //1
  
  Live example: http://ideone.com/z7PIRx
  
  