stdmap

Is it safe to read a single c++ std::map object by different threads simultaneously without synchronization mechanisms?

I have a global object holding several c++ std::map objects. This object is supposed to be read only in a multithreaded environment. But i'm not sure whether there is any write operation when a C++ std::map object is being read within the implementation of std::map. The IDE is Visual Studio 2008. Should I provide some synchronization mec...

How to modify key values in std::map container

Given std::map<int,std::string> myMap; fillMyMapWithStuff(myMap); // modify key values - I need to add a constant value to each key for (std::map<int,std::string>::iterator mi=myMap.begin(); mi != myMap.end(); ++mi) { // ... } Whats a good way apply some re-indexing? Must I remove the old entry and add a new one with the new key ...

std::map sort by data?

Is there a way to sort std::map by the data rather than the key? Right now my code duplicates the entire map in to an array just to do this. ...

How to use a struct in std::map ?

I have a complex struct i want to put as a key of the std::map to make a list of all unique objects fast: union somecomplexstruct { struct { more_structs val1, val2; even_more_structs val3, val4; lots_of_more_structs val5; }; unsigned int DATA[3]; }; typedef map<somecomplexstruct, int, greater<som...