I have the following code
Parser.hh
namespace Essembly {
...
public:
Parser();
private:
std::unique_ptr<FactoryExpr> factory;
...
}
Parser.cc
namespace Essembly {
Parser::Parser(): factory(std::make_unique<FactoryExpr>()) { }
}
and this is the factory FactoryExpr.hh
namespace Essembly {
class FactoryExpr {
public:
FactoryExpr();
~FactoryExpr();
}
}
FactoryExpr.cc
namespace Essembly {
FactoryExpr::FactoryExpr(){ }
FactoryExpr::~FactoryExpr() { }
}
Unfortunately, I get the following error
std::__1::unique_ptr<FactoryExpr> Essembly::Parser::factory
no instance of constructor "std::__1::unique_ptr<_Tp, _Dp>::unique_ptr [with _Tp=FactoryExpr, _Dp=std::__1::default_delete<FactoryExpr>]" matches the argument listC/C++(289)
parser.cc(9, 26): argument types are: (std::__1::unique_ptr<Essembly::FactoryExpr, std::__1::default_delete<Essembly::FactoryExpr>>)
I browsed on SO and the MICROSOFT docs, and I think I am doing this correctly. Could someone spot the mistake.