forward declaration + unique_ptr == ```cpp // MainClass.h struct MyClassImp; struct MyClassImpDeleter{ void operator()(MyClassImp*); } class MyClass { std::unique_ptr<MyClassImp, MyClassImpDeleter> pImp; }; ``` ```cpp // MainClass.cpp struct MyClassImp { ... }; void MyClassImpDeleter::operator()(MyClassImp* pImp) { delete pImp; } ``` References: - [StackOverflow.com/std::unique_ptr with an incomplete type won't compile](https://stackoverflow.com/a/17950450/2210478)
×
Sign in
Email
Password
Forgot password
or
By clicking below, you agree to our
terms of service
.
Sign in via Facebook
Sign in via Twitter
Sign in via GitHub
Sign in via Dropbox
Sign in with Wallet
Wallet (
)
Connect another wallet
New to HackMD?
Sign up