
I see... Then the whole problem could be solved just by using deque instead of vector - since deque does't guarantee contiguous memory block for its elements, and thus it shouldn't reallocate the storage.> >> > The problem with this code is that you are returning a reference > to data that might be immediately invalidated. A push_back via > another thread can cause the referenced memory to no longer be valid.> > Does push_back() really invalidate iterators to *previous* vector elements?!> > Yes: it might have to allocate a new chunk of memory for the vector, in which> case it will have to move all the existing elements to the new memory, and> free the old one.> > Anthony _________________________________________________________________ News, entertainment and everything you care about at Live.com. Get it now! http://www.live.com/getstarted.aspx