Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: auto_ptr not behaving as per header comment




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:
http://lists.apple.com/mailman/options/darwin-dev/email@hidden

This email sent to email@hidden

References: 
 >auto_ptr not behaving as per header comment (From: Steve Checkoway <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.