我讀這個答案霍華德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();
////