Boost logo

Boost Users :

Subject: Re: [Boost-users] Problem with enable_shared_from_this and shared_ptr
From: Ganeshram Iyer (ganeshramiyer_at_[hidden])
Date: 2010-07-21 10:47:09


Ryan,
Is there any chance you can post what you added to your provided example to
fix the problem you were having? I would love to see what that example looks
like when it is working.
Thanks in advance
Ganesh

On Tue, Jul 20, 2010 at 10:59 PM, Ryan McConnehey <mccorywork_at_[hidden]>wrote:

> Michael Caisse wrote:
>
>> Ryan McConnehey wrote:
>>
>>> Michael Caisse wrote:
>>>
>>>> Ryan -
>>>>
>>>> See the documentation here:
>>>> <
>>>> http://www.boost.org/doc/libs/1_43_0/libs/smart_ptr/enable_shared_from_this.html>
>>>>
>>>>
>>>> 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*
>>
>> -------------------
>>
>> Your right. I didn't understand that part very well. After I put pool
> in a shared_ptr it worked fine. Thanks for your help.
>
> Ryan
>
> _______________________________________________
> Boost-users mailing list
> Boost-users_at_[hidden]
> http://lists.boost.org/mailman/listinfo.cgi/boost-users
>

-- 
Ganeshram Iyer
Open Source and CAD: http://ossandcad.blogspot.com
ganeshramiyer_at_[hidden]


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