3 #ifndef CDSLIB_CONTAINER_DETAILS_MAKE_LAZY_LIST_H
4 #define CDSLIB_CONTAINER_DETAILS_MAKE_LAZY_LIST_H
6 #include <cds/details/binary_functor_wrapper.h>
8 namespace cds { namespace container {
13 template <class GC, typename T, class Traits>
18 typedef Traits original_type_traits;
20 struct node_type : public intrusive::lazy_list::node<gc, typename original_type_traits::lock_type>
28 node_type( Q const& v )
31 template <typename... Args>
32 node_type( Args&&... args )
33 : m_Value( std::forward<Args>(args)...)
37 typedef typename original_type_traits::allocator::template rebind<node_type>::other allocator_type;
38 typedef cds::details::Allocator< node_type, allocator_type > cxx_allocator;
40 struct node_deallocator
42 void operator ()( node_type * pNode )
44 cxx_allocator().Delete( pNode );
48 typedef typename opt::details::make_comparator< value_type, original_type_traits >::type key_comparator;
49 typedef typename opt::details::make_equal_to< value_type, original_type_traits >::type equal_to_comparator;
51 struct value_accessor {
52 value_type const & operator()( node_type const & node ) const
58 template <typename Less>
60 typedef cds::details::compare_wrapper< node_type, cds::opt::details::make_comparator_from_less<Less>, value_accessor > type;
63 template <typename Equal>
64 struct equal_to_wrapper {
65 typedef cds::details::predicate_wrapper< node_type, Equal, value_accessor > type;
68 struct intrusive_traits: public original_type_traits
70 typedef intrusive::lazy_list::base_hook< opt::gc<gc> > hook;
71 typedef node_deallocator disposer;
72 static CDS_CONSTEXPR const opt::link_check_type link_checker = cds::intrusive::lazy_list::traits::link_checker;
74 typedef cds::details::compare_wrapper< node_type, key_comparator, value_accessor > compare;
75 typedef cds::details::predicate_wrapper< node_type, equal_to_comparator, value_accessor > equal_to;
78 typedef intrusive::LazyList<gc, node_type, intrusive_traits> type;
80 } // namespace details
83 }} // namespace cds::container
85 #endif // #ifndef CDSLIB_CONTAINER_DETAILS_MAKE_MICHAEL_LIST_H