Relative Content

Tag Archive for c++11type-conversionunique-ptr

Convert unique_ptr of derived class to unique_tr of base class with custom deleter class

I am facing problems to convert the unique pointer unique_ptr<Derived,Deleter<Derived>> to the unique pointer unique_ptr<Base,Deleter<Base>>. The class Derived is, of course, derived from the class Base, and the template class Deleter overloads the () operator to create a custom deletion routine to the unique pointer. Using std::move returns an error and all my other attemps have failed. Is this conversion really possible?.