Boost logo

Boost Users :

Subject: Re: [Boost-users] [Intrusive] safe_link assertion with list
From: Pearl Rothman (prothman_at_[hidden])
Date: 2009-06-10 15:55:19


I am not trying to store a copy. I am trying to store the original Message
itself, and not have the container delete the Message when I remove it..
Essentially I want to have m_message_list store Messages that I can remove,
use, and then re-add to it.. How can I fix the code?

Once I add Message to the list, I do not need it anywhere else. How can I
fix the code?

How can I fix my code to do this?

2009/6/10 Ion Gaztañaga <igaztanaga_at_[hidden]>

> Pearl Rothman wrote:
>
>> I am using Fedora 9, gcc 4.3.0, and boost 1.38.0.
>>
>> I get the following error when calling the destroyMessage function.
>>
>
> virtual void destroyMessage( Message* msg )
>> {
>> MessageHook hook(msg);
>> m_message_list.push_back( hook );
>> }
>>
>> private:
>> boost::intrusive::list<stockTraderMessageHook> m_message_list;
>> };
>>
>
> Take in care that intrusive containers don't store copies of objects but
> objects themselves. So in destroyMessage "hook" is going to be destroyed
> while inserted in m_message_list and that's why you get the assertion. See
> documentation:
>
>
> http://www.boost.org/doc/libs/1_39_0/doc/html/intrusive/intrusive_vs_nontrusive.html#intrusive.intrusive_vs_nontrusive.differences_intrusive_vs_nontrusive
>
> Maybe you just need std::list instead of intrusive.
>
> Best,
>
> Ion
> _______________________________________________
> Boost-users mailing list
> Boost-users_at_[hidden]
> http://lists.boost.org/mailman/listinfo.cgi/boost-users
>



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