我读这个答案霍华德Hinnant(Is std::unique_ptr<T> required to know the full definition of T?),然后这个答案(How is a template instantiated?),我只是在想。如果你有像这样 class Something {
Something();
~Something();
cla
只要我不将构造函数的定义(B)移动到标头B.h,代码就会工作。 B.h class Imp; //<--- error here
class B{
public:
std::unique_ptr<Imp> imp;
B(); //<--- move definition to here will compile error
~B();
////