I have an object (Z) which derives from two other objects (A and B).
A and B both derive from enable_shared_from_this<>, respectively enable_shared_from_this<A> and enable_shared_from_this<B>.
Of course I call shared_from_this() on Z. And of course the compiler reports this as ambiguous.
My questions are :
- is it safe to inherit twice from
enable_shared_from_this<>or will it create two separated reference counts (bad !) - If not safe, how do I solve this ?
Note :
I've found this other question bad weak pointer when base and derived class both inherit from boost::enable_shared_from_this but it doesn't really answer. Should I use the virtual trick too ?