Boost logo

Boost :

Subject: Re: [boost] [smart_ptr] Moving cast for unique_ptr
From: Kohei Takahashi (flast_at_[hidden])
Date: 2015-10-07 22:08:56

Hi Karolin,

On 2015/10/06 19:19, Karolin Varner wrote:
> There is the family of boost pointer cast (boost::static_pointer_cast, boost::dynamic_pointer_cast, ...) that allow a developer to write generic code by casting pointers regardless of whether they are some smart pointer (e.g. shared_ptr) or plain pointers.
> However, those functions have not been implemented for unique_ptr, because they create a copy of their pointer and unique_pointers can not be copied.
I disagree this option because user can write unsafe code easily, see .
It based on your dynamic_cast version, but it is also dangerous for
other casts (static, const, ...).

Kohei Takahashi

Boost list run by bdawes at, gregod at, cpdaniel at, john at