3 #ifndef __CDS_CONTAINER_SPLIT_LIST_BASE_H
4 #define __CDS_CONTAINER_SPLIT_LIST_BASE_H
6 #include <cds/intrusive/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 intrusive::split_list::dynamic_bucket_table;
22 template <typename Key, typename Value, typename Traits, typename Opt>
23 struct wrap_map_traits_helper {
24 typedef Opt key_accessor;
27 template <typename Key, typename Value, typename Traits >
28 struct wrap_map_traits_helper<Key, Value, Traits, opt::none>
33 key_type const & operator()( std::pair<Key const, Value> const & val ) const
40 template <typename Key, typename Value, typename Traits>
41 struct wrap_map_traits: public Traits
43 typedef typename wrap_map_traits_helper<Key, Value, Traits, typename Traits::key_accessor>::key_accessor key_accessor;
46 template <typename Value, typename Traits, typename Opt>
47 struct wrap_set_traits_helper {
48 typedef Opt key_accessor;
51 template <typename Value, typename Traits >
52 struct wrap_set_traits_helper<Value, Traits, opt::none>
56 typedef Value key_type;
57 key_type const& operator()( Value const& val ) const
64 template <typename Value, typename Traits>
65 struct wrap_set_traits: public Traits
67 typedef typename wrap_set_traits_helper<Value, Traits, typename Traits::key_accessor>::key_accessor key_accessor;
69 } // namespace details
73 /// Type traits for SplitListSet class
75 Note, the SplitListSet type traits is based on intrusive::split_list::type_traits.
76 Any member declared in intrusive::split_list::type_traits is also applied to
77 container::split_list::type_traits.
79 struct type_traits: public intrusive::split_list::type_traits
81 // Ordered list implementation
83 This option selects appropriate ordered-list implementation for split-list.
84 It may be \ref michael_list_tag or \ref lazy_list_tag.
86 typedef michael_list_tag ordered_list;
88 // Ordered list traits
90 With this option you can specify type traits for selected ordered list class.
91 If this option is opt::none, the ordered list traits is combined with default
92 ordered list traits and split-list traits.
94 For \p michael_list_tag, the default traits is \ref container::michael_list::type_traits.
96 For \p lazy_list_tag, the default traits is \ref container::lazy_list::type_traits.
98 typedef opt::none ordered_list_traits;
101 typedef opt::none key_accessor;
105 /// Option to select ordered list class for split-list
107 This option selects appropriate ordered list class for containers based on split-list.
108 Template parameter \p Type may be \ref michael_list_tag or \ref lazy_list_tag.
110 template <class Type>
114 template<class Base> struct pack: public Base
116 typedef Type ordered_list;
121 /// Option to specify ordered list type traits
123 The \p Type template parameter specifies ordered list type traits.
124 It depends on type of ordered list selected.
126 template <class Type>
127 struct ordered_list_traits
130 template<class Base> struct pack: public Base
132 typedef Type ordered_list_traits;
137 /// Metafunction converting option list to traits struct
139 Available \p Options:
140 - split_list::ordered_list - a tag for ordered list implementation.
141 See split_list::ordered_list for possible values.
142 - split_list::ordered_list_traits - type traits for ordered list implementation.
143 For MichaelList use container::michael_list::type_traits,
144 for LazyList use container::lazy_list::type_traits.
145 - plus any option from intrusive::split_list::make_traits
147 template <CDS_DECL_OPTIONS8>
149 typedef typename cds::opt::make_options< type_traits, CDS_OPTIONS8>::type type ; ///< Result of metafunction
151 } // namespace split_list
154 // Forward declarations
155 template <class GC, class T, class Traits = split_list::type_traits>
158 template <class GC, typename Key, typename Value, class Traits = split_list::type_traits>
163 // Forward declaration
165 template <typename GC, typename T, typename OrderedListTag, typename Traits>
166 struct make_split_list_set;
168 template <typename GC, typename Key, typename Value, typename OrderedListTag, typename Traits>
169 struct make_split_list_map;
173 }} // namespace cds::container
176 #endif // #ifndef __CDS_CONTAINER_SPLIT_LIST_BASE_H