|
Boost Users : |
Subject: Re: [Boost-users] Multiple Inheritance and enable_shared_from_this
From: Igor R (boost.lists_at_[hidden])
Date: 2011-07-28 16:53:36
> This is what I expect: I expect the get_shared_from_derived call to work,
> since the _internal_accept_owner would visit it. Â I would also expect the
> call to get_shared_from_base to fail with a bad_weak_ptr, since it looks
> like there is only one call in shared_ptr's constructor. Â I expect that the
> actual behavior is probably undefined, since it would depend on which
> association the compiler feels more strongly about: the
> enable_shared_from_this<derived> from derived or the
> enable_shared_from_this<base> from base.
> What I expect is, of course, not happening, which is why I turn to the Boost
> gurus.  Neither of the calls work: they both fail with a bad_weak_ptr.  Why
> would this happen?
FWIW, with VC10 get_shared_from_base() works correctly (because
weak_this_ in enable_shared_from_this<base> is initialized).
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