Boost logo

Boost Users :

Subject: Re: [Boost-users] Problem with enable_shared_from_this and shared_ptr
From: Michael Caisse (boost_at_[hidden])
Date: 2010-07-20 22:44:05

Ryan McConnehey wrote:
> Michael Caisse wrote:
>> Ryan -
>> See the documentation here:
>> <>
>> There must be at least one shared_ptr instance that owns the object
>> that you are calling shared_from_this() on. Also see the examples at
>> the above link.
>> hth -
>> michael
> I've looked at that documentation already. That's part of why of I
> know I should be able to do what I want.
> Ryan

Not very carefully... so let me quote from the above link directly:


template<class T> shared_ptr<T const> enable_shared_from_this<T>::shared_from_this() const;

    *Requires:* *enable_shared_from_this<T>* must be an accessible base class of *T*.
    **this* must be a subobject of an instance *t* of type *T* . There must exist at least
    one *shared_ptr* instance *p* that /owns/ *t*


Michael Caisse
Object Modeling Designs

Boost-users list run by williamkempf at, kalb at, bjorn.karlsson at, gregod at, wekempf at