
On 3/27/2012 5:08 AM, ivan.lelann@free.fr wrote:
snip...
My main point is that if having more than one enable_shared_from_this<> in the inheritance hierarchy normally fails, this should be documented with the proper information on how to workaround the problem.
I agree.
I wondered how current C++11 standard libraries handled this. With VS2010, replacing "boost" with "std" made both "shared_from_this()" calls throw. (with two esft bases the compiler chooses a dummy specialization)
I think it is quite simply that there can not be more than one enable_shared_from_this derivation in a hierarchy. Unfortunately one is left to discover this for himself. Similarly there is no mention in the docs that using shared_from_this() during construction is not going to work either. The documentation for enable_shared_from_this needs to be better.