Boost logo

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