3 #ifndef CDSLIB_CONTAINER_DETAILS_SPLIT_LIST_BASE_H
4 #define CDSLIB_CONTAINER_DETAILS_SPLIT_LIST_BASE_H
6 #include <cds/intrusive/details/split_list_base.h>
8 namespace cds { namespace container {
10 // forward declaration
11 struct michael_list_tag;
13 /// SplitListSet related definitions
14 /** @ingroup cds_nonintrusive_helper
16 namespace split_list {
17 /// Internal statistics, see \p cds::intrusive::split_list::stat
18 template <typename Counter = cds::intrusive::split_list::stat<>::counter_type >
19 using stat = cds::intrusive::split_list::stat<Counter>;
21 /// Disabled internal statistics, see \p cds::intrusive::split_list::empty_stat
22 typedef cds::intrusive::split_list::empty_stat empty_stat;
24 /// Selector of bucket table implementation =- typedef for \p intrusive::split_list::dynamic_bucket_table
26 using dynamic_bucket_table = cds::intrusive::split_list::dynamic_bucket_table<Value>;
28 using cds::intrusive::split_list::static_bucket_table;
29 using cds::intrusive::split_list::expandable_bucket_table;
34 template <typename Key, typename Value, typename Traits, typename Opt>
35 struct wrap_map_traits_helper {
36 typedef Opt key_accessor;
39 template <typename Key, typename Value, typename Traits >
40 struct wrap_map_traits_helper<Key, Value, Traits, opt::none>
45 key_type const & operator()( std::pair<Key const, Value> const & val ) const
52 template <typename Key, typename Value, typename Traits>
53 struct wrap_map_traits: public Traits
55 typedef typename wrap_map_traits_helper<Key, Value, Traits, typename Traits::key_accessor>::key_accessor key_accessor;
58 template <typename Value, typename Traits, typename Opt>
59 struct wrap_set_traits_helper {
60 typedef Opt key_accessor;
63 template <typename Value, typename Traits >
64 struct wrap_set_traits_helper<Value, Traits, opt::none>
68 typedef Value key_type;
69 key_type const& operator()( Value const& val ) const
76 template <typename Value, typename Traits>
77 struct wrap_set_traits: public Traits
79 typedef typename wrap_set_traits_helper<Value, Traits, typename Traits::key_accessor>::key_accessor key_accessor;
81 } // namespace details
85 /// SplitListSet traits
86 struct traits: public intrusive::split_list::traits
88 // Ordered list implementation
90 Selects appropriate ordered-list implementation for split-list.
92 - \p michael_list_tag - for \p MichaelList
93 - \p lazy_list_tag - for \p LazyList
95 typedef michael_list_tag ordered_list;
97 // Ordered list traits
99 Specifyes traits for selected ordered list type, default type:
100 - for \p michael_list_tag: \p container::michael_list::traits.
101 - for \p lazy_list_tag: \p container::lazy_list::traits.
103 If this type is \p opt::none, the ordered list traits is combined with default
104 ordered list traits above and split-list traits.
106 typedef opt::none ordered_list_traits;
109 typedef opt::none key_accessor;
113 /// Option to select ordered list class for split-list
115 This option selects appropriate ordered list class for containers based on split-list.
116 Template parameter \p Type may be \p michael_list_tag or \p lazy_list_tag.
118 template <class Type>
122 template<class Base> struct pack: public Base
124 typedef Type ordered_list;
129 /// Option to specify ordered list type traits
131 The \p Type template parameter specifies ordered list type traits.
132 It depends on type of ordered list selected.
134 template <class Type>
135 struct ordered_list_traits
138 template<class Base> struct pack: public Base
140 typedef Type ordered_list_traits;
145 /// Metafunction converting option list to traits struct
147 Available \p Options:
148 - \p split_list::ordered_list - a tag for ordered list implementation.
149 - \p split_list::ordered_list_traits - type traits for ordered list implementation.
150 For \p MichaelList use \p container::michael_list::traits or derivatives,
151 for \p LazyList use \p container::lazy_list::traits or derivatives.
152 - plus any option from \p intrusive::split_list::make_traits
154 template <typename... Options>
156 typedef typename cds::opt::make_options< traits, Options...>::type type ; ///< Result of metafunction
158 } // namespace split_list
161 // Forward declarations
162 template <class GC, class T, class Traits = split_list::traits>
165 template <class GC, typename Key, typename Value, class Traits = split_list::traits>
170 // Forward declaration
172 template <typename GC, typename T, typename OrderedListTag, typename Traits>
173 struct make_split_list_set;
175 template <typename GC, typename Key, typename Value, typename OrderedListTag, typename Traits>
176 struct make_split_list_map;
180 }} // namespace cds::container
183 #endif // #ifndef CDSLIB_CONTAINER_DETAILS_SPLIT_LIST_BASE_H