Boost logo

Boost Users :

Subject: Re: [Boost-users] [intrusive] accessing the hook type?
From: Ion Gaztañaga (igaztanaga_at_[hidden])
Date: 2015-10-18 07:03:57


On 17/10/2015 18:04, Oliver Kowalke wrote:
> I'd like to determine the hook type of an intrusive container
> (intrusive::list):
>
> template< typename List >
> void do_link( List & lst) {
> static_assert(std::is_same< typename List::???, my_hook_type >::value);
> lst.push_back( * this);
> }

Hi,

There is no current typedef for that. The closest thing is
"value_traits", which is what the container understands. Each hook type
is transformed to "value_traits" which tells the container how the value
and the node (stored in the hook) communicate.

If "value_traits" option is passed instead of a hook, then
container::value_traits is the same type. If a hook is passed (or
deduced, if the default hook is used), then that information is
transformed in a "value_traits" defined here:

boost/intrusive/hook_traits.hpp

(e.g. boost::intrusive::detail::bhtraits<T, NodeTraits, LinkMode, Tag,
Type> for a base hook).

If this information is important, then we should design a better
interface to check it. "value_traits" is not a very good name for what
it does, maybe "hook_traits" would have been a better name. The issue is
that a "hook" (which could be deduced form "value_type" if the
programmer does not provide it) is not directly transformed on what the
container really uses ("value_traits").

Best,

Ion


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