enable_shared_from_this<manager<Policy>>
is a “dependent base” (it’s a base class whose type depends on a template parameter, in this case Policy
) so the rules of C++ say that unqualified name lookup doesn’t look in there, you need to say this->shared_from_this()
or std::enable_shared_from_this<manage<Policy>>::shared_from_this()
to find the member from the dependent base.
See http://gcc.gnu.org/wiki/VerboseDiagnostics#dependent_base for more detail and links to other references.
To fix the second error you need to make enable_shared_from_this
a public base class, or it can’t get initialized when the manager is owned by a shared_ptr
.