Boost logo

Boost Users :

From: Igor R. (igor_rubinov_at_[hidden])
Date: 2008-05-16 07:04:25


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



Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net