Is
struct A
{
std::unique_ptr<A> a;
};
allowed by the standard? I don't think it is for container types like std::set but is there something special about unique_ptr?
Yes, it's explicitly allowed. C++14 (n4140) 20.8.1/5:
... The template parameter
Tofunique_ptrmay be an incomplete type.
It is also allowed for std::shared_ptr and std::weak_ptr, using similar wording.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With