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