Boost logo

Boost :

From: Peter Dimov (pdimov_at_[hidden])
Date: 2002-02-25 11:27:47


From: "Rainer Deyke" <root_at_[hidden]>
> From: "Peter Dimov" <pdimov_at_[hidden]>
> > From: "Mark Rodgers" <mark.rodgers_at_[hidden]>
> > > Please let me know if you think this, or something close to it,
> > > is worthy of documentation and submission.
> >
> > What are the main differences between auto_vector<T> and vector<
> > shared_ptr<T> > ?
>
> 'vector<shared_ptr<T> >' does not enforce strict ownership,

Why is this a good thing? If I have a raw pointer and the auto_vector<>
dies, I'm left with a dangling pointer.

OTOH if I never hold pointers to objects when the container dies, then a
vector<shared_ptr<T>> will be equivalent to auto_vector.

> uses much
> more memory, and is slightly slower on operations that copy the
> underlying objects.

Yes, the size/performance implications are, well, implied. :-) I was
thinking about the semantics. I.e. is an auto_vector only an optimization,
to be used when size/performance matters?


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk