Even you could find out if the pointer is valid, this will not solve your problem. You are sharing the only resource that is not a guarantor of exlusivelty. That is why it will fail.
It will fail in this thread sequence:
Thread0 ................................ Thread1
Get iterator-> it0
check that it0 is really
............................................. Get Iterator β it1
............................................. make sure that it1 really .
Erase (it0)
............................................. Erase (it1)
You can add a semaphore to access the shared resource.
Doug Rogers Apr 17 '09 at 15:17 2009-04-17 15:17
source share