|
Boost Users : |
Subject: Re: [Boost-users] [shared_ptr] Multiple enable_shared_from_this in inheritance tree
From: Edward Diener (eldiener_at_[hidden])
Date: 2012-03-27 19:56:24
On 3/27/2012 5:08 AM, ivan.lelann_at_[hidden] 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.
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net