You are viewing a single comment's thread. Return to all comments →
following the coded to check whether element key "test" exists using find method.
map<string, int> m; cout << "Map size: " << m.size() << endl; cout << "Missing key value: " << m["test"] << endl; cout << "Map size: " << m.size() << endl; auto it = m.find("test"); if(it != m.end()) { std::cout << "test = " << it->second; }
then the output
Map size: 0 Missing key value: 0 Map size: 1 test = 0
Seems like cookies are disabled on this browser, please enable them to open this website
Maps-STL
You are viewing a single comment's thread. Return to all comments →
following the coded to check whether element key "test" exists using find method.
then the output