I have some code in a header that looks like this:
#include
class Thing;
class MyClass
{
std::unique_ptr< Thing > my_thing;
};
I was looking for a way to use the PIMPL idiom with std::unique_ptr. This guide is a great resource.
In short, here's what you can do to make it work:
#include
class Thing;
class MyClass
{
~MyClass(); // <--- Added
std::unique_ptr< Thing > my_thing;
};
MyClass::~MyClass() = default; // Or a custom implementation