std::const_pointer_cast std::cref std::ctime std::current_exception std::decay std::declare_no_pointers std::declare_reachable std::declval std::default_delete std::default_searcher std::destroy std::destroy_at
r-the pointer to convert Notes The expressionsstd::shared_ptr<T>(static_cast<T*>(r.get())),std::shared_ptr<T>(dynamic_cast<T*>(r.get()))andstd::shared_ptr<T>(const_cast<T*>(r.get()))might seem to have the same effect, but they all will likely result in undefined behavior...
std::shared_ptr<T> static_pointer_cast( const std::shared_ptr<U>& r ) noexcept; (1) (since C++11) template< class T, class U > std::shared_ptr<T> static_pointer_cast( std::shared_ptr<U>&& r ) noexcept; (2) (since C++20) template< class T, class U > std::shared_ptr...
std::shared_ptr<T> static_pointer_cast( const std::shared_ptr<U>& r ) noexcept; (1) (C++11 起) template< class T, class U >std::shared_ptr<T> static_pointer_cast( std::shared_ptr<U>&& r ) noexcept; (2) (C++20 起) template< class T, class U >std::shared_ptr<T> ...
1) static_cast<Y*>(r.get()).2) dynamic_cast<Y*>(r.get()) (if the result of the dynamic_cast is a null pointer value, the returned shared_ptr will be empty).3) const_cast<Y*>(r.get()).4) reinterpret_cast<Y*>(r.get())....