Boost logo

Boost :

Subject: Re: [boost] [smart_ptr] Moving cast for unique_ptr
From: Karolin Varner (karo_at_[hidden])
Date: 2015-10-08 10:48:44


Hi Gavin

On 10/08/2015 03:01 PM, Peter Dimov wrote:
> Karolin Varner wrote:
>
>> For std::shared_ptr and the other pointers we might still emulate a moving cast in order to facilitate generic programming.
>
> Like Gavin, I'm not sure I quite see the point of using dynamic_pointer_cast on an rvalue in generic code, because if it fails, the original is lost.

Yeah, I was thinking of using an implementation, where the input pointer would only be moved, if the cast is successful.
In case the cast wasn't successfully. we could return a NULL pointer and leave the input as it was.

Best,
Karolin


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk