Save pointer to map
std::map<Key,Value> mymap;
(void)mymap[Key(...)]; // create value if not there
typename std::map<Key,Value>::iterator it = mymap.find(key);
it->second.pkey = &it->first; // store a pointer to the actual key
It's safe? In other words, is the card allowed to copy the key during insert / erase operations, resulting in invalidation Value::pkey
?
Differences in C ++ 98 vs C ++ 11 on this?
+3
source to share