std::unique_ptr with derived class
If they are polymorphic types and you only need a pointer to the derived type use dynamic_cast: Derived *derivedPointer = dynamic_cast<Derived*>(basePointer.get()); If they are not polymorphic types only need a pointer to the derived type use static_cast and hope for the best: Derived *derivedPointer = static_cast<Derived*>(basePointer.get()); If you need to convert a unique_ptr containing a … Read more