Patch for auto_ptr + test (fwd)

Nathan Myers ncm@cantrip.org
Wed Jun 14 11:46:00 GMT 2000


> From: "Branko [iso-8859-2] ?ibej" <branko.cibej@hermes.si>
> Subject: Patch for auto_ptr + test
> 
> I had a look at the implementation of auto_ptr, and I think it's
> not conformant in the following details:
> 
>     - struct auto_ptr_ref is defined outside class auto_ptr; it should
>       be a private nested struct (20.4.5p1);
>     - auto_ptr::operator auto_ptr_ref releases the pointer too soon;
>       it should be released by auto_ptr::auto_ptr(auto_ptr_ref)
>       (20.4.5.3p1,2,3);
>     - assignment from auto_ptr_ref shouldn't be defined.
> 
> I've attached a patch for bits/std_memory.h that fixes these problems,
> as well as a test case for auto_ptr that should go into 
> testsuite/20_utilities.

This patch shouldn't go in as is.

In particular, the nested struct doesn't work properly with
a conforming compiler.  The other two changes might be good
(I don't recall).

Any changes to auto_ptr should reflect the recommendations
in the Library Working Group issues list, which Benjamin
is better-equipped than I to quote, at the moment.

Nathan Myers
ncm@cantrip.org


More information about the Libstdc++ mailing list