Mega Code Archive

 
Categories / C++ / Data Structure
 

[] automatically inserts elements

#include <iostream> #include <map> using namespace std; int main() {   map<char, int> mapObject;   cout << "Initial size of map: " << mapObject.size() << endl;   cout << "The value associated with A is " << mapObject['A'];   cout << endl;   cout << "Size of map is now: " << mapObject.size() << endl;   return 0; }