Boost logo

Boost Users :

From: Stuart Dootson (stuart.dootson_at_[hidden])
Date: 2005-04-23 04:18:26


On 4/22/05, Bo Peng <ben.bob_at_[hidden]> wrote:
> > 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.
>
> This may be a good solution. The only problem is that find(...) will
> be looking for identical pointers instead of identical objects. Easy
> to fix though.
>
> Thank you very much.
> Bo
>

Easiest to fix using indirect_iterators
(http://www.boost.org/libs/iterator/doc/indirect_iterator.html) rather
than raw container iterators...

Stuart Dootson


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