|
Boost : |
From: Martin Bonner (martin.bonner_at_[hidden])
Date: 2005-12-07 12:11:51
----Original Message----
From: Yuval Ronen [mailto:ronen_yuval_at_[hidden]]
Sent: 07 December 2005 16:20
To: boost_at_[hidden]
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_at_[hidden] Pi Technology, Milton Hall, Ely Road, Milton, Cambridge, CB4 6WZ, ENGLAND Tel: +44 (0)1223 441434
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk