Is the code below safe? It might be tempting to write code akin to this:
#include
No, the C++ standard makes no such guarantees.
That said, if the code is in the same translation unit then it would be difficult to find a counter example. If main() is in a different translation then a counter example might be easier to produce.
If the map is in a different dynamic linked library or shared object then it's almost certainly not the case.
The volatile qualifier is a red herring.