
24 Sep
2009
24 Sep
'09
4:11 p.m.
std::pair<cMap::iterator, bool> inserted = myMap.insert(cMap::value_type(cMap::key_type(givenName, properInt), cmap::mapped_type())); if (! inserted.second) // oh, it already existed? { ... }
Since I'm using both givenName and properInt as a key, the insert will never return false for just a duplicate of givenName. Also, if the insert did return false then it means a good value at that map key has been replaced. The reason I'm trying to catch this duplication is because "last value entered wins" doesn't meet the requirement I was given. Ryan