This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

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


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

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]