Re: auto_ptr not behaving as per header comment
Re: auto_ptr not behaving as per header comment
- Subject: Re: auto_ptr not behaving as per header comment
- From: Steve Checkoway <email@hidden>
- Date: Wed, 10 Aug 2005 00:54:41 -0700
On Aug 9, 2005, at 7:51 PM, Andy Newman wrote:
The initialization of ptr notionally invokes the copy constructor.
Now std::auto_ptr's copy constructor takes a non-const reference arg
and you're not allowed to have non-const references to temporary
objects such as the one generated to convert the auto_ptr types.
Hence the error.
Isn't the whole purpose of the of the auto_ptr_ref struct to allow this?
In the line std::auto_ptr<foo> ptr2(get_bar());, it uses operator
auto_ptr_ref<_Tp>() and the auto_ptr(auto_ptr_ref ref) ctor (twice
each, I think).
Is there some reason that it doesn't do this for the assignment line?
It seems like the comment in the header is wrong if the code is an
error.
- Steve
Attachment:
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden