If I wish to use dynamic_cast with a shared_ptr I can use dynamic_pointer_cast. What do I use if I wish to cast an auto_ptr? I’m assuming something that would look like below.
struct B : A { };
...
auto_ptr<A> base( ... );
auto_ptr<B> derive = dynamic_pointer_cast<B>(base);
I’m using boost for shared_ptr’s
Since you’re already doing that, then refactor it, slap it in the namespace of your choice and call it a day: