
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
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_nontrus...
Maybe you just need std::list instead of intrusive.
Best,
Ion _______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users