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++.


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

	thanx & later,

		Ben Scherrey

Gabriel Dos_Reis wrote:
> 
> Benjamin Scherrey <scherrey@switchco.com> writes:
> 
> | This is actually a problem that's been around for a little while but I
> | forgot about it until just recently when I installed 2.95.1 on my
> | intel linux system. I've got some code that uses the auto_ptr type
> | defined in the include file 'memory'. My code's a bit too large to be
> | used as a good test case example but the issue is probably apparent to
> | the g++ maintainers (or is this just an STL issue?).
> |
> | At line 37 of the include file 'memory' is a constructor for auto_ptr
> | that takes a non-const auto_ptr&. There is no explicit copy ctor that
> | takes a const auto_ptr&.
> 
> Well, this is a C++ specific issue.  autor_ptr<T> is designed on
> purpose to not be CopyConstructible nor Assignable; hence you can't
> put it in a container and expect any reasonable behaviour.
> 
> -- Gaby


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