c++_primer_exercise_1124

What does the following program do?

map<int, int> m;

m[0] = 1;

answer:

  • m is searched for the element whose key is 0. The element is not found.
  • A new key-value pair is inserted into m. The key is a const int holding 0. The value is initialized, meaning in this case that the value is 0.
  • The newly inserted element is fetched and is given the value 1.


你可能感兴趣的:(c++_primer_exercise_1124)