Update: the shared_ptr in this example is like the one in Boost, but it doesn\'t support shared_polymorphic_downcast (or dynamic_pointer_cast or static_pointer_cas
If somebody gets here with boost::shared_ptr...
This is how you can downcast to the derived Boost shared_ptr. Assuming Derived inherits from Base.
boost::shared_ptr bS;
bS.reset(new Derived());
boost::shared_ptr dS = boost::dynamic_pointer_cast(bS);
std::cout << "DerivedSPtr is: " << std::boolalpha << (dS.get() != 0) << std::endl;
Make sure 'Base' class/struct has at least one virtual function. A virtual destructor also works.