What I've got right now is a setup like this:
template<typename T> class Parent {
struct Nested;
std::unique_ptr<Nested> ptr;
public:
// stuff
~Parent();
};
template<typename T> struct Parent<T>::Nested {
Parent<T> p;
// stuff
};
Visual Studio gives me an error that the Nested
struct is using an incomplete type Parent
- even though the definition is after the Parent
class is complete.
How can I resolve this issue?
Edit: In case it wasn't apparent, I have used a delayed destructor definition until after the Nested
class is defined to allow a unique_ptr
to an incomplete type. In addition, it most definitely is not related to that, because the error isn't that Nested
is incomplete- it's that Nested
contains a member of type Parent
, which is incomplete. In addition, if I explicitly erase the deleter by using std::function<void(Nodes*)>
the problem is not solved.