Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Where is the std equivalent of boost::shared_polymorphic_downcast in C++11?

boost::shared_polymorphic_downcast and the other boost::shared_ptr functions reside in <boost/shared_ptr.hpp>

I recently enabled support for C++11 in GCC with -std=c++0x. In order to avoid confusion, I moved from boost::shared_ptr to std::shared_ptr which resides in #include <memory>.

However it appears that shared_polymorphic_downcast is not part of the std namespace and is not included with #include <memory>.

Do you know where it is? Did I miss the deprecation memo ;-)

like image 229
Alan Turing Avatar asked Jun 12 '11 00:06

Alan Turing


1 Answers

You either need std::static_pointer_cast or std::dynamic_pointer_cast, depending on whether you want static_cast or dynamic_cast behavior.

Recent versions of Boost's Smart Pointers library include these functions for boost::shared_ptr too.

like image 132
James McNellis Avatar answered Oct 18 '22 19:10

James McNellis