Re: [boost] [shared_ptr] constructor accepting auto_ptr

----Original Message---- From: Yuval Ronen [mailto:ronen_yuval@yahoo.com] Sent: 07 December 2005 16:20 To: boost@lists.boost.org Subject: Re: [boost] [shared_ptr] constructor accepting auto_ptr
Peter Dimov wrote:
The reference adds a strong exception safety guarantee. If the shared_ptr constructor fails, the source auto_ptr is left intact. Pass by value would have already zeroed out the source.
If you want to achieve the equivalent of pass by value, you can use an explicit .release().
This warning would actually be an error on a stricter compiler.
One happy day the compiler writers will bring us the rvalue reference, the constructor will take auto_ptr &&, and all will be well with the world. :-)
Does that mean that on a stricter compiler, when passing a temporary auto_ptr, I *have* to use the '.release()' way, and *can't* get the strong exception guarantee?
No. You can always create a named temporary, and bind the reference to that.
Thanks a lot to both of you Peter and Howard for your help.
_______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
-- Martin Bonner Martin.Bonner@Pitechnology.com Pi Technology, Milton Hall, Ely Road, Milton, Cambridge, CB4 6WZ, ENGLAND Tel: +44 (0)1223 441434
participants (1)
-
Martin Bonner