From: Nevin :-] Liber on
In article <cO2dndzT0r6uIRLWnZ2dnUVZ_sWqnZ2d(a)giganews.com>,
Pete Becker <pete(a)versatilecoding.com> wrote:

> jaybus56 wrote:
> >
> > I would do it this way because I prefer initializer lists (RAII):
> >
> > class A{};
> > class B{};
> > class C{};
> >
> > class X
> > {
> > auto_ptr<A> a;
> > auto_ptr<B> b;
> > auto_ptr<C> c;
> >
>
> But there are very few situations in which the wierd copy and assignment
> semantics of a class like this are useful. It certainly isn't a general
> replacement for a class holding raw pointers.

While weird, it does solve the memory leaks / double delete / exception
safety problems of the original code. I do agree that this code would
be much better if it did not use the compiler generated copy/assignment.

--
Nevin ":-)" Liber <mailto:nevin(a)eviloverlord.com> 773 961-1620

[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]