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 using cds::intrusive::split_list::implementation_tag;
19 /// Internal statistics, see \p cds::intrusive::split_list::stat
20 template <typename Counter = cds::intrusive::split_list::stat<>::counter_type >
21 using stat = cds::intrusive::split_list::stat<Counter>;
23 /// Disabled internal statistics, see \p cds::intrusive::split_list::empty_stat
24 typedef cds::intrusive::split_list::empty_stat empty_stat;
26 /// Selector of bucket table implementation =- typedef for \p intrusive::split_list::dynamic_bucket_table
28 using dynamic_bucket_table = cds::intrusive::split_list::dynamic_bucket_table<Value>;
30 using cds::intrusive::split_list::static_bucket_table;
31 using cds::intrusive::split_list::expandable_bucket_table;
36 template <typename Key, typename Value, typename Traits, typename Opt>
37 struct wrap_map_traits_helper {
38 typedef Opt key_accessor;
41 template <typename Key, typename Value, typename Traits >
42 struct wrap_map_traits_helper<Key, Value, Traits, opt::none>
47 key_type const & operator()( std::pair<Key const, Value> const & val ) const
54 template <typename Key, typename Value, typename Traits>
55 struct wrap_map_traits: public Traits
57 typedef typename wrap_map_traits_helper<Key, Value, Traits, typename Traits::key_accessor>::key_accessor key_accessor;
60 template <typename Value, typename Traits, typename Opt>
61 struct wrap_set_traits_helper {
62 typedef Opt key_accessor;
65 template <typename Value, typename Traits >
66 struct wrap_set_traits_helper<Value, Traits, opt::none>
70 typedef Value key_type;
71 key_type const& operator()( Value const& val ) const
78 template <typename Value, typename Traits>
79 struct wrap_set_traits: public Traits
81 typedef typename wrap_set_traits_helper<Value, Traits, typename Traits::key_accessor>::key_accessor key_accessor;
83 } // namespace details
87 /// SplitListSet traits
88 struct traits: public intrusive::split_list::traits
90 // Ordered list implementation
92 Selects appropriate ordered-list implementation for split-list.
94 - \p michael_list_tag - for MichaelList
95 - \p lazy_list_tag - for LazyList
97 typedef michael_list_tag ordered_list;
99 // Ordered list traits
101 Specifyes traits for selected ordered list type, default type:
102 - for \p michael_list_tag: \p container::michael_list::traits.
103 - for \p lazy_list_tag: \p container::lazy_list::traits.
105 If this type is \p opt::none, the ordered list traits is combined with default
106 ordered list traits above and split-list traits.
108 typedef opt::none ordered_list_traits;
111 typedef opt::none key_accessor;
115 /// Option to select ordered list class for split-list
117 This option selects appropriate ordered list class for containers based on split-list.
118 Template parameter \p Type may be \p michael_list_tag or \p lazy_list_tag.
120 template <class Type>
124 template<class Base> struct pack: public Base
126 typedef Type ordered_list;
131 /// Option to specify ordered list type traits
133 The \p Type template parameter specifies ordered list type traits.
134 It depends on type of ordered list selected.
136 template <class Type>
137 struct ordered_list_traits
140 template<class Base> struct pack: public Base
142 typedef Type ordered_list_traits;
147 /// Metafunction converting option list to traits struct
149 Available \p Options:
150 - \p split_list::ordered_list - a tag for ordered list implementation.
151 - \p split_list::ordered_list_traits - type traits for ordered list implementation.
152 For \p MichaelList use \p container::michael_list::traits or derivatives,
153 for \p LazyList use \p container::lazy_list::traits or derivatives.
154 - plus any option from \p intrusive::split_list::make_traits
156 template <typename... Options>
158 typedef typename cds::opt::make_options< traits, Options...>::type type ; ///< Result of metafunction
160 } // namespace split_list
163 // Forward declarations
164 template <class GC, class T, class Traits = split_list::traits>
167 template <class GC, typename Key, typename Value, class Traits = split_list::traits>
172 // Forward declaration
174 template <typename GC, typename T, typename OrderedListTag, typename Traits>
175 struct make_split_list_set;
177 template <typename GC, typename Key, typename Value, typename OrderedListTag, typename Traits>
178 struct make_split_list_map;
182 }} // namespace cds::container
185 #endif // #ifndef CDSLIB_CONTAINER_DETAILS_SPLIT_LIST_BASE_H