On Apr 14, 7:53 pm, Noah Roberts <u...@example.net> wrote:
> Vladislav.Lazare...@gmail.com wrote:
> > On Apr 14, 6:38 pm, Simon L <silang...@hotmail.com> wrote:
> >> Pointer mismanagement is a big cause of bugs in software that I work
> >> on. I decided to invest a little time into
> >> having a look at auto_ptr and other smart pointers but I don't see how
> >> they'll save me making the same mistakes.
>
> > Well designed smart pointers library will not allow you to make a
> > mistake. It is not a good idea to use std::auto_ptr template with
> > vector or any other collection that performs object copying.
> > std::auto_ptr will not manage this situation for you. Never.
>
> Well, std::auto_ptr violates copy and assignment semantics. It therefor
> CAN'T be used in a std::vector. You can attempt to, sure, but it will
> not work and that's why.
That's exactly what I am talking about. I use ptr_container for Boost
for these purposes or list of shared pointer if they should really be
shared