Boost logo

Boost :

Subject: Re: [boost] [smart_ptr] Moving cast for unique_ptr
From: Karolin Varner (karo_at_[hidden])
Date: 2015-12-21 07:10:03


Hi,

I have created a pull request based on the discussion in this thread: https://github.com/boostorg/smart_ptr/pull/23
It doesn't yet contain optimizations for copyable pointers, but it contains pointer_cast overloads for std::shared_ptr and std::unique_ptr.

Since this came up in this thread, I also created a motivating example for static_pointer_cast(std::unique_ptr<...>&&) and dynamic_pointer_cast(std::unique_ptr<...>&&)
http://melpon.org/wandbox/permlink/R3QWA7MaxZ5o1ocG

It also seems that, even there are no overloads with move semantics for shared_ptr, calling the pointer casts with std::move(...) works. So in principle we could use move(...) for those and implement optimizations later.
Though I am not quite convinced, that this is good behavior.

Best,
Karolin


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