I need to use VS2012 compiler and have:
virtual std::unique_ptr<MyType> pass_through(std::unique_ptr<MyType> instance) override { return std::unique_ptr<MyType>(nullptr); };
That definition exists only for a project as a stub and without the MyType destructor, I get following error:
error LNK2001: unresolved external symbol "public: __thiscall MyType::~MyType(void)" (??1MyType@@QAE@XZ)
So I created a definition:
MyType::~MyType() {}
and that is the problem, I don't want to have the confusing definition just so the function above passes build.. so is there a way to not need to specify the destructor definition and still have valid implementation of that pass_through method?
Maybe I can somehow change the signature of the method or it's logic to do basically the same in the primary implementation, it does something like:
std::unique_ptr<MyType> pass_through(std::unique_ptr<MyType> instance)
{
if (!instance) {
instance= std::unique_ptr<MyType>(new MyType(/*arguments*/));
}
instance->something();
return instance;
}
Btw I see similar question are downvoted/closed, but still in the suggestions I don't see any relevant answer and I also used google before and still no hit => maybe somehow promote the relevant question with good answer, if there is any?