$include_dir="/home/hyper-archives/boost/include"; include("$include_dir/msg-header.inc") ?>
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
http://melpon.org/wandbox/permlink/x6Fj1QSwdD9fBAfA .
It based on your dynamic_cast version, but it is also dangerous for
other casts (static, const, ...).
Best,
Kohei Takahashi