
7 Oct
2015
7 Oct
'15
7:45 p.m.
Vicente J. Botet Escriba wrote:
Just wondering if we can not make dynamic_pointer_cast to work as your dynamic_moving_pointer_cast, when the parameter is a rvalue reference
Yes, that was my first thought as well. template<class T, class U> unique_ptr<T> dynamic_pointer_cast( unique_ptr<U> && r ) noexcept { T * p = dynamic_cast<T*>( r.get() ); if( p ) r.release(); return unique_ptr<T>( p ); }