I need to copy a std::unique_ptr<Interface>
of some interface Interface
.
This post sums it nice up, but it doesn't work in my case, because Interface
doesn't have an available constructor.
Example:
//Pointer to copy
std::unique_ptr<Interface> ptr = std::make_unique<Interface>();
//error: incomplete type is not allowed
std::unique_ptr<Interface> copy{ new Interface(*ptr.get().data) };
Is there a way to deep copy ptr
to copy
?