Problem with auto_prt copy-ctor under last several versions of g++.

Gabriel Dos_Reis Gabriel.Dos_Reis@sophia.inria.fr
Tue Aug 31 23:20:00 GMT 1999


Benjamin Scherrey <scherrey@switchco.com> writes:

| Darn - this is a pain. I guess I'll have to drop the auto_ptr in my
| code. Meanwhile, shouldn't there be an explicit private declaration of
| the copy constructor and assignment operators in order to make this
| disallowment more clear. 

Why??? The C++ definition does define them public.  GCC is following
the Standard.

| ... Also, what is the purpose of having a
| constructor that takes a non-const instance if copy constructors are
| supposed to be illegal?

Not being CopyConstructible isn't equivalent to having private copy
constructor.  Furthermore having a copy constructor taking a non-const 
reference makes it sure that temporaries are not copiable.  

If your point is that auto_ptr<T> is useless, please consider

	news:comp.std.c++

-- Gaby



More information about the Gcc mailing list