|
Boost Users : |
From: Joaquin M López Muñoz (joaquinlopezmunoz_at_[hidden])
Date: 2021-09-11 11:11:01
El 11/09/2021 a las 12:50, John Emmas via Boost-users escribió:
> Hi Ion and Jaoquin - our own code is obviously more complicated than
> my examples and currently
> uses 'list_member_hook<>'.
>
> This morning I modified it to use tags and then later (when that
> wouldn't compile) I tried using
> 'list_base_hook<>' - but both cases triggered a compile-time assertion
> here in 'boost/intrusive/detail/generic_hook.hpp':-
>
> Â Â BOOST_INTRUSIVE_FORCEINLINE void unlink()
> Â Â {
> /* This line asserts ---> */Â BOOST_STATIC_ASSERT((
> (int)hooktags::link_mode == (int)auto_unlink ));
> Â Â Â Â Â node_ptr n(this->this_ptr());
> Â Â Â Â Â if(!node_algorithms::inited(n)){
> Â Â Â Â Â Â Â Â node_algorithms::unlink(n);
> Â Â Â Â Â Â Â Â node_algorithms::init(n);
> Â Â Â Â Â }
> Â Â }
This looks like an element has been destroyed before being removed from
the list(s) it belongs in.
To enable such scenarios you have to set the auto-unlink mode (not set
by default):
https://www.boost.org/doc/html/intrusive/auto_unlink_hooks.html
So, you have two options:
* Make sure that elements are removed from lists before being destroyed
* Activate auto-unlink mode for your lists
JoaquÃn M López Muñoz
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