diff --git a/include/boost/intrusive/any_hook.hpp b/include/boost/intrusive/any_hook.hpp index 809507c..6d18781 100644 --- a/include/boost/intrusive/any_hook.hpp +++ b/include/boost/intrusive/any_hook.hpp @@ -48,7 +48,8 @@ struct make_any_base_hook >::type packed_options; typedef generic_hook - < any_algorithms + < AnyAlgorithm + , any_node_traits , typename packed_options::tag , packed_options::link_mode , AnyBaseHookId @@ -153,7 +154,8 @@ struct make_any_member_hook >::type packed_options; typedef generic_hook - < any_algorithms + < AnyAlgorithm + , any_node_traits , member_tag , packed_options::link_mode , NoBaseHookId diff --git a/include/boost/intrusive/avl_set_hook.hpp b/include/boost/intrusive/avl_set_hook.hpp index b61f95f..1871303 100644 --- a/include/boost/intrusive/avl_set_hook.hpp +++ b/include/boost/intrusive/avl_set_hook.hpp @@ -47,7 +47,8 @@ struct make_avl_set_base_hook ::type packed_options; typedef generic_hook - < avltree_algorithms > + < AvlTreeAlgorithms + , avltree_node_traits , typename packed_options::tag , packed_options::link_mode , AvlTreeBaseHookId @@ -177,7 +178,8 @@ struct make_avl_set_member_hook ::type packed_options; typedef generic_hook - < avltree_algorithms > + < AvlTreeAlgorithms + , avltree_node_traits , member_tag , packed_options::link_mode , NoBaseHookId diff --git a/include/boost/intrusive/bs_set_hook.hpp b/include/boost/intrusive/bs_set_hook.hpp index e96248b..a64c15a 100644 --- a/include/boost/intrusive/bs_set_hook.hpp +++ b/include/boost/intrusive/bs_set_hook.hpp @@ -47,7 +47,8 @@ struct make_bs_set_base_hook ::type packed_options; typedef generic_hook - < bstree_algorithms > + < BsTreeAlgorithms + , tree_node_traits , typename packed_options::tag , packed_options::link_mode , BsTreeBaseHookId @@ -176,7 +177,8 @@ struct make_bs_set_member_hook ::type packed_options; typedef generic_hook - < bstree_algorithms > + < BsTreeAlgorithms + , tree_node_traits , member_tag , packed_options::link_mode , NoBaseHookId diff --git a/include/boost/intrusive/detail/algo_type.hpp b/include/boost/intrusive/detail/algo_type.hpp index 6da48e9..70ec63f 100644 --- a/include/boost/intrusive/detail/algo_type.hpp +++ b/include/boost/intrusive/detail/algo_type.hpp @@ -35,7 +35,10 @@ enum algo_types AvlTreeAlgorithms, SgTreeAlgorithms, SplayTreeAlgorithms, - TreapAlgorithms + TreapAlgorithms, + UnorderedAlgorithms, + UnorderedCircularSlistAlgorithms, + AnyAlgorithm }; template diff --git a/include/boost/intrusive/detail/any_node_and_algorithms.hpp b/include/boost/intrusive/detail/any_node_and_algorithms.hpp index 4b087b5..26a1edc 100644 --- a/include/boost/intrusive/detail/any_node_and_algorithms.hpp +++ b/include/boost/intrusive/detail/any_node_and_algorithms.hpp @@ -23,8 +23,9 @@ #include #include -#include #include +#include +#include namespace boost { namespace intrusive { @@ -279,6 +280,17 @@ class any_algorithms } }; +///@cond + +template +struct get_algo +{ + typedef typename pointer_rebind::type void_pointer; + typedef any_algorithms type; +}; + +///@endcond + } //namespace intrusive } //namespace boost diff --git a/include/boost/intrusive/detail/generic_hook.hpp b/include/boost/intrusive/detail/generic_hook.hpp index b57a12b..c85b389 100644 --- a/include/boost/intrusive/detail/generic_hook.hpp +++ b/include/boost/intrusive/detail/generic_hook.hpp @@ -26,6 +26,7 @@ #include #include #include +#include #include namespace boost { @@ -120,7 +121,8 @@ struct hooktags_impl /// @endcond template - < class NodeAlgorithms + < boost::intrusive::algo_types Algo + , class NodeTraits , class Tag , link_mode_type LinkMode , base_hook_type BaseHookType @@ -135,20 +137,20 @@ class generic_hook //from the hook. : public detail::if_c < detail::is_same::value - , typename NodeAlgorithms::node - , node_holder + , typename NodeTraits::node + , node_holder >::type //If this is the a default-tagged base hook derive from a class that //will define an special internal typedef. Containers will be able to detect this //special typedef and obtain generic_hook's internal types in order to deduce //value_traits for this hook. , public hook_tags_definer - < generic_hook + < generic_hook , detail::is_same::value*BaseHookType> /// @endcond { /// @cond - typedef NodeAlgorithms node_algorithms; + typedef typename get_algo::type node_algorithms; typedef typename node_algorithms::node node; typedef typename node_algorithms::node_ptr node_ptr; typedef typename node_algorithms::const_node_ptr const_node_ptr; @@ -156,7 +158,7 @@ class generic_hook public: typedef hooktags_impl - < typename NodeAlgorithms::node_traits + < NodeTraits , Tag, LinkMode, BaseHookType> hooktags; node_ptr this_ptr() diff --git a/include/boost/intrusive/list_hook.hpp b/include/boost/intrusive/list_hook.hpp index aef7253..892e4e2 100644 --- a/include/boost/intrusive/list_hook.hpp +++ b/include/boost/intrusive/list_hook.hpp @@ -50,7 +50,8 @@ struct make_list_base_hook >::type packed_options; typedef generic_hook - < circular_list_algorithms > + < CircularListAlgorithms + , list_node_traits , typename packed_options::tag , packed_options::link_mode , ListBaseHookId @@ -177,7 +178,8 @@ struct make_list_member_hook >::type packed_options; typedef generic_hook - < circular_list_algorithms > + < CircularListAlgorithms + , list_node_traits , member_tag , packed_options::link_mode , NoBaseHookId diff --git a/include/boost/intrusive/set_hook.hpp b/include/boost/intrusive/set_hook.hpp index b641280..e303b64 100644 --- a/include/boost/intrusive/set_hook.hpp +++ b/include/boost/intrusive/set_hook.hpp @@ -49,7 +49,8 @@ struct make_set_base_hook >::type packed_options; typedef generic_hook - < rbtree_algorithms > + < RbTreeAlgorithms + , rbtree_node_traits , typename packed_options::tag , packed_options::link_mode , RbTreeBaseHookId @@ -180,7 +181,8 @@ struct make_set_member_hook >::type packed_options; typedef generic_hook - < rbtree_algorithms > + < RbTreeAlgorithms + , rbtree_node_traits , member_tag , packed_options::link_mode , NoBaseHookId diff --git a/include/boost/intrusive/slist_hook.hpp b/include/boost/intrusive/slist_hook.hpp index c3f5ffd..0f37772 100644 --- a/include/boost/intrusive/slist_hook.hpp +++ b/include/boost/intrusive/slist_hook.hpp @@ -50,7 +50,8 @@ struct make_slist_base_hook >::type packed_options; typedef generic_hook - < circular_slist_algorithms > + < CircularSListAlgorithms + , slist_node_traits , typename packed_options::tag , packed_options::link_mode , SlistBaseHookId @@ -178,7 +179,8 @@ struct make_slist_member_hook >::type packed_options; typedef generic_hook - < circular_slist_algorithms > + < CircularSListAlgorithms + , slist_node_traits , member_tag , packed_options::link_mode , NoBaseHookId diff --git a/include/boost/intrusive/unordered_set_hook.hpp b/include/boost/intrusive/unordered_set_hook.hpp index 95a575a..a18d235 100644 --- a/include/boost/intrusive/unordered_set_hook.hpp +++ b/include/boost/intrusive/unordered_set_hook.hpp @@ -152,19 +152,33 @@ struct uset_algo_wrapper : public Algo {}; template -struct get_uset_node_algo +struct get_uset_node_traits { typedef typename detail::if_c < (StoreHash || OptimizeMultiKey) , unordered_node_traits , slist_node_traits - >::type node_traits_type; - typedef typename detail::if_c - < OptimizeMultiKey - , unordered_algorithms - , uset_algo_wrapper< circular_slist_algorithms > >::type type; }; + +template +struct get_uset_algo_type +{ + static const algo_types value = OptimizeMultiKey ? UnorderedAlgorithms : UnorderedCircularSlistAlgorithms; +}; + +template +struct get_algo +{ + typedef unordered_algorithms type; +}; + +template +struct get_algo +{ + typedef uset_algo_wrapper< circular_slist_algorithms > type; +}; + /// @endcond //! Helper metafunction to define a \c unordered_set_base_hook that yields to the same @@ -187,10 +201,11 @@ struct make_unordered_set_base_hook >::type packed_options; typedef generic_hook - < typename get_uset_node_algo < typename packed_options::void_pointer - , packed_options::store_hash - , packed_options::optimize_multikey - >::type + < get_uset_algo_type ::value + , typename get_uset_node_traits < typename packed_options::void_pointer + , packed_options::store_hash + , packed_options::optimize_multikey + >::type , typename packed_options::tag , packed_options::link_mode , HashBaseHookId @@ -326,10 +341,11 @@ struct make_unordered_set_member_hook >::type packed_options; typedef generic_hook - < typename get_uset_node_algo< typename packed_options::void_pointer - , packed_options::store_hash - , packed_options::optimize_multikey - >::type + < get_uset_algo_type ::value + , typename get_uset_node_traits < typename packed_options::void_pointer + , packed_options::store_hash + , packed_options::optimize_multikey + >::type , member_tag , packed_options::link_mode , NoBaseHookId