I have one implementation class and one wrapper class, and I want to access to implementation class instance through wrapper class with structure dereference (->) operator. So far, no problem.
class Implementation
{
public:
doSomething();
}
class Wrapper
{
public:
Implementation* operator->() {
return _implPtr.get();
}
private:
std::shared_ptr<Implementation> _implPtr;
}
It works when I use it like below:
Wrapper wrapper;
wrapper->doSomething();
But when I use the wrapper class with unique_ptr, compiler throws an error:
auto wrapper = std::make_unique<Wrapper>();
wrapper->doSomething();
The error is "'class Wrapper' has no member named 'doSomething'".
How can I access to the implementation class in this scenario?