For two threads manipulating a container map for example, what the correct way to test whether an iterator still valid (for performance reason) ? Or would be of only in
If you implement a reader/writer solution, then you can have the writer set a flag that invalidates all the iterators of the readers.
http://en.wikipedia.org/wiki/Readers-writer_lock
I would not try to write to the map without synchronization, as Josh and Paul Tomblin mentioned.