Boost logo

Boost Users :

From: Arkadiy Vertleyb (vertleyb_at_[hidden])
Date: 2005-04-22 16:37:58


"Bo Peng" <ben.bob_at_[hidden]> wrote

> I need direct access ( save and use element pointers) to container
> elements in my application. std::vector<obj> can not be used since
> vector::push_back etc may relocate objs.

Just a suggestion:

Can you, instead of storing objects in your vector, allocate the objects on
the heap and store pointers (or shared pointers) to them? In this case you
would not have to worry about the vector moving it's elements around -- it
would be just moving pointers.

Regards,

Arkadiy


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