3 #ifndef CDSLIB_CONTAINER_DETAILS_LAZY_LIST_BASE_H
4 #define CDSLIB_CONTAINER_DETAILS_LAZY_LIST_BASE_H
6 #include <cds/container/details/base.h>
7 #include <cds/intrusive/details/lazy_list_base.h>
8 #include <cds/urcu/options.h>
10 namespace cds { namespace container {
12 /// LazyList ordered list related definitions
13 /** @ingroup cds_nonintrusive_helper
18 Either \p compare or \p less or both must be specified.
22 /// allocator used to allocate new node
23 typedef CDS_DEFAULT_ALLOCATOR allocator;
25 /// Key comparing functor
27 No default functor is provided. If the option is not specified, the \p less is used.
29 typedef opt::none compare;
31 /// Specifies binary predicate used for key comparing
33 Default is \p std::less<T>.
35 typedef opt::none less;
37 /// Lock type used to lock modifying items
39 Default is cds::sync::spin
41 typedef cds::sync::spin lock_type;
43 /// back-off strategy used
44 typedef cds::backoff::Default back_off;
46 /// Item counting feature; by default, disabled. Use \p cds::atomicity::item_counter to enable item counting
47 typedef atomicity::empty_item_counter item_counter;
49 /// C++ memory ordering model
51 Can be \p opt::v::relaxed_ordering (relaxed memory model, the default)
52 or \p opt::v::sequential_consistent (sequentially consisnent memory model).
54 typedef opt::v::relaxed_ordering memory_model;
56 /// RCU deadlock checking policy (only for \ref cds_intrusive_LazyList_rcu "RCU-based LazyList")
58 List of available options see \p opt::rcu_check_deadlock
60 typedef opt::v::rcu_throw_deadlock rcu_check_deadlock;
63 // LazyKVList: supporting for split-ordered list
64 // key accessor (opt::none = internal key type is equal to user key type)
65 typedef opt::none key_accessor;
70 /// Metafunction converting option list to \p lazy_list::traits
73 - \p opt::lock_type - lock type for node-level locking. Default \p is cds::sync::spin. Note that <b>each</b> node
74 of the list has member of type \p lock_type, therefore, heavy-weighted locking primitive is not
75 acceptable as candidate for \p lock_type.
76 - \p opt::compare - key compare functor. No default functor is provided.
77 If the option is not specified, the \p opt::less is used.
78 - \p opt::less - specifies binary predicate used for key compare. Default is \p std::less<T>.
79 - \p opt::back_off - back-off strategy used. If the option is not specified, \p cds::backoff::Default is used.
80 - \p opt::item_counter - the type of item counting feature. Default is disabled (\p atomicity::empty_item_counter).
81 To enable item counting use \p atomicity::item_counter.
82 - \p opt::allocator - the allocator used for creating and freeing list's item. Default is \ref CDS_DEFAULT_ALLOCATOR macro.
83 - \p opt::memory_model - C++ memory ordering model. Can be \p opt::v::relaxed_ordering (relaxed memory model, the default)
84 or \p opt::v::sequential_consistent (sequentially consisnent memory model).
86 template <typename... Options>
88 # ifdef CDS_DOXYGEN_INVOKED
89 typedef implementation_defined type ; ///< Metafunction result
91 typedef typename cds::opt::make_options<
92 typename cds::opt::find_type_traits< traits, Options... >::type
99 } // namespace lazy_list
101 // Forward declarations
102 template <typename GC, typename T, typename Traits=lazy_list::traits>
105 template <typename GC, typename Key, typename Value, typename Traits=lazy_list::traits>
108 // Tag for selecting lazy list implementation
110 This struct is empty and it is used only as a tag for selecting LazyList
111 as ordered list implementation in declaration of some classes.
113 See \p split_list::traits::ordered_list as an example.
118 }} // namespace cds::container
121 #endif // #ifndef CDSLIB_CONTAINER_DETAILS_LAZY_LIST_BASE_H