Trivial cases of shared_ptr and weak_ptr failing
You must inherit publicly from std::enable_shared_from_this
. Inheriting privately doesn't help - std::shared_ptr
can't access the base class and set it up properly.
You have to publicly inherit from std::enable_shared_from_this
in order for it to work.