我有奇怪的问题。我声明了 map::iterator 的迭代器,但它不起作用。问题出在哪里?
string name "John";
int count = 200;
map<string,int> store;
map<string,int>::iterator it;
it = store.find( name );
if ( it != store.end() )
{
it->second += count;
} else
{
store.insert( make_pair (name, count) );
}