3 #ifndef __CDS_INTRUSIVE_DETAILS_SPLIT_LIST_BASE_H
4 #define __CDS_INTRUSIVE_DETAILS_SPLIT_LIST_BASE_H
6 #include <cds/intrusive/details/base.h>
7 #include <cds/cxx11_atomic.h>
8 #include <cds/details/allocator.h>
9 #include <cds/algo/int_algo.h>
10 #include <cds/algo/bitop.h>
12 namespace cds { namespace intrusive {
14 /// Split-ordered list related definitions
15 /** @ingroup cds_intrusive_helper
17 namespace split_list {
18 /// Split-ordered list node
21 - OrderedListNode - node type for underlying ordered list
23 template <typename OrderedListNode>
24 struct node: public OrderedListNode
27 typedef OrderedListNode base_class;
30 size_t m_nHash ; ///< Hash value for node
32 /// Default constructor
39 /// Initializes dummy node with \p nHash value
46 /// Checks if the node is dummy node
49 return (m_nHash & 1) == 0;
53 /// SplitListSet internal statistics. May be used for debugging or profiling
55 Template argument \p Counter defines type of counter.
56 Default is \p cds::atomicity::event_counter, that is weak, i.e. it is not guaranteed
57 strict event counting.
58 You may use stronger type of counter like as \p cds::atomicity::item_counter,
59 or even integral type, for example, \p int.
61 template <typename Counter = cds::atomicity::event_counter >
64 typedef Counter counter_type; ///< Counter type
66 counter_type m_nInsertSuccess; ///< Count of success inserting
67 counter_type m_nInsertFailed; ///< Count of failed inserting
68 counter_type m_nEnsureNew; ///< Count of new item created by \p ensure() member function
69 counter_type m_nEnsureExist; ///< Count of \p ensure() call for existing item
70 counter_type m_nEraseSuccess; ///< Count of success erasing of items
71 counter_type m_nEraseFailed; ///< Count of attempts to erase unknown item
72 counter_type m_nExtractSuccess; ///< Count of success extracting of items
73 counter_type m_nExtractFailed; ///< Count of attempts to extract unknown item
74 counter_type m_nFindSuccess; ///< Count of success finding
75 counter_type m_nFindFailed; ///< Count of failed finding
76 counter_type m_nHeadNodeAllocated; ///< Count of allocated head node
77 counter_type m_nHeadNodeFreed; ///< Count of freed head node
78 counter_type m_nBucketCount; ///< Current bucket count
79 counter_type m_nInitBucketRecursive; ///< Count of recursive bucket initialization
80 counter_type m_nInitBucketContention; ///< Count of bucket init contention encountered
81 counter_type m_nBusyWaitBucketInit; ///< Count of busy wait cycle while a bucket is initialized
84 void onInsertSuccess() { ++m_nInsertSuccess; }
85 void onInsertFailed() { ++m_nInsertFailed; }
86 void onEnsureNew() { ++m_nEnsureNew; }
87 void onEnsureExist() { ++m_nEnsureExist; }
88 void onEraseSuccess() { ++m_nEraseSuccess; }
89 void onEraseFailed() { ++m_nEraseFailed; }
90 void onExtractSuccess() { ++m_nExtractSuccess; }
91 void onExtractFailed() { ++m_nExtractFailed; }
92 void onFindSuccess() { ++m_nFindSuccess; }
93 void onFindFailed() { ++m_nFindFailed; }
94 bool onFind(bool bSuccess)
102 void onHeadNodeAllocated() { ++m_nHeadNodeAllocated; }
103 void onHeadNodeFreed() { ++m_nHeadNodeFreed; }
104 void onNewBucket() { ++m_nBucketCount; }
105 void onRecursiveInitBucket() { ++m_nInitBucketRecursive; }
106 void onBucketInitContenton() { ++m_nInitBucketContention; }
107 void onBusyWaitBucketInit() { ++m_nBusyWaitBucketInit; }
111 /// Dummy queue statistics - no counting is performed, no overhead. Support interface like \p split_list::stat
114 void onInsertSuccess() const {}
115 void onInsertFailed() const {}
116 void onEnsureNew() const {}
117 void onEnsureExist() const {}
118 void onEraseSuccess() const {}
119 void onEraseFailed() const {}
120 void onExtractSuccess() const {}
121 void onExtractFailed() const {}
122 void onFindSuccess() const {}
123 void onFindFailed() const {}
124 bool onFind( bool bSuccess ) const { return bSuccess; }
125 void onHeadNodeAllocated() const {}
126 void onHeadNodeFreed() const {}
127 void onNewBucket() const {}
128 void onRecursiveInitBucket() const {}
129 void onBucketInitContenton() const {}
130 void onBusyWaitBucketInit() const {}
134 /// SplitListSet traits
139 Hash function converts the key fields of struct \p T stored in the split list
140 into hash value of type \p size_t that is an index in hash table.
142 Hash typedef is mandatory and has no predefined one.
144 typedef opt::none hash;
148 The item counting is an important part of \p SplitListSet algorithm:
149 the <tt>empty()</tt> member function depends on correct item counting.
150 Therefore, \p cds::atomicity::empty_item_counter is not allowed as a type of the option.
152 Default is \p cds::atomicity::item_counter.
154 typedef cds::atomicity::item_counter item_counter;
156 /// Bucket table allocator
158 Allocator for bucket table. Default is \ref CDS_DEFAULT_ALLOCATOR
160 typedef CDS_DEFAULT_ALLOCATOR allocator;
162 /// Internal statistics (by default, disabled)
164 Possible statistics types are: \p split_list::stat (enable internal statistics),
165 \p split_list::empty_stat (the default, internal statistics disabled),
166 user-provided class that supports \p %split_list::stat interface.
168 typedef split_list::empty_stat stat;
171 /// C++ memory ordering model
173 Can be \p opt::v::relaxed_ordering (relaxed memory model, the default)
174 or \p opt::v::sequential_consistent (sequentially consisnent memory model).
176 typedef opt::v::relaxed_ordering memory_model;
178 /// What type of bucket table is used
180 \p true - use \p split_list::expandable_bucket_table that can be expanded
181 if the load factor of the set is exhausted.
182 \p false - use \p split_list::static_bucket_table that cannot be expanded
183 and is allocated in \p SplitListSet constructor.
187 static const bool dynamic_bucket_table = true;
189 /// Back-off strategy
190 typedef cds::backoff::Default back_off;
193 /// [value-option] Split-list dynamic bucket table option
195 The option is used to select bucket table implementation.
196 Possible values of \p Value are:
197 - \p true - select \p expandable_bucket_table
198 - \p false - select \p static_bucket_table
200 template <bool Value>
201 struct dynamic_bucket_table
204 template <typename Base> struct pack: public Base
206 enum { dynamic_bucket_table = Value };
211 /// Metafunction converting option list to \p split_list::traits
213 Available \p Options:
214 - \p opt::hash - mandatory option, specifies hash functor.
215 - \p opt::item_counter - optional, specifies item counting policy. See \p traits::item_counter
217 - \p opt::memory_model - C++ memory model for atomic operations.
218 Can be \p opt::v::relaxed_ordering (relaxed memory model, the default)
219 or \p opt::v::sequential_consistent (sequentially consisnent memory model).
220 - \p opt::allocator - optional, bucket table allocator. Default is \ref CDS_DEFAULT_ALLOCATOR.
221 - \p split_list::dynamic_bucket_table - use dynamic or static bucket table implementation.
222 Dynamic bucket table expands its size up to maximum bucket count when necessary
223 - \p opt::back_off - back-off strategy used for spinning, defult is \p cds::backoff::Default.
225 template <typename... Options>
227 typedef typename cds::opt::make_options< traits, Options...>::type type ; ///< Result of metafunction
230 /// Static bucket table
232 Non-resizeable bucket table for \p SplitListSet class.
233 The capacity of table (max bucket count) is defined in the constructor call.
236 - \p GC - garbage collector
237 - \p Node - node type, must be a type based on \p split_list::node
238 - \p Options... - options
241 - \p opt::allocator - allocator used to allocate bucket table. Default is \ref CDS_DEFAULT_ALLOCATOR
242 - \p opt::memory_model - memory model used. Possible types are \p opt::v::sequential_consistent, \p opt::v::relaxed_ordering
244 template <typename GC, typename Node, typename... Options>
245 class static_bucket_table
248 struct default_options
250 typedef CDS_DEFAULT_ALLOCATOR allocator;
251 typedef opt::v::relaxed_ordering memory_model;
253 typedef typename opt::make_options< default_options, Options... >::type options;
257 typedef GC gc; ///< Garbage collector
258 typedef Node node_type; ///< Bucket node type
259 typedef atomics::atomic<node_type *> table_entry; ///< Table entry type
261 /// Bucket table allocator
262 typedef cds::details::Allocator< table_entry, typename options::allocator > bucket_table_allocator;
264 /// Memory model for atomic operations
265 typedef typename options::memory_model memory_model;
268 const size_t m_nLoadFactor; ///< load factor (average count of items per bucket)
269 const size_t m_nCapacity; ///< Bucket table capacity
270 table_entry * m_Table; ///< Bucket table
274 void allocate_table()
276 m_Table = bucket_table_allocator().NewArray( m_nCapacity, nullptr );
281 bucket_table_allocator().Delete( m_Table, m_nCapacity );
286 /// Constructs bucket table for 512K buckets. Load factor is 1.
287 static_bucket_table()
289 , m_nCapacity( 512 * 1024 )
294 /// Creates the table with specified size rounded up to nearest power-of-two
296 size_t nItemCount, ///< Max expected item count in split-ordered list
297 size_t nLoadFactor ///< Load factor
299 : m_nLoadFactor( nLoadFactor > 0 ? nLoadFactor : (size_t) 1 ),
300 m_nCapacity( cds::beans::ceil2( nItemCount / m_nLoadFactor ) )
302 // m_nCapacity must be power of 2
303 assert( cds::beans::is_power2( m_nCapacity ) );
307 /// Destroys bucket table
308 ~static_bucket_table()
313 /// Returns head node of bucket \p nBucket
314 node_type * bucket( size_t nBucket ) const
316 assert( nBucket < capacity() );
317 return m_Table[ nBucket ].load(memory_model::memory_order_acquire);
320 /// Set \p pNode as a head of bucket \p nBucket
321 void bucket( size_t nBucket, node_type * pNode )
323 assert( nBucket < capacity() );
324 assert( bucket( nBucket ) == nullptr );
326 m_Table[ nBucket ].store( pNode, memory_model::memory_order_release );
329 /// Returns the capacity of the bucket table
330 size_t capacity() const
335 /// Returns the load factor, i.e. average count of items per bucket
336 size_t load_factor() const
338 return m_nLoadFactor;
342 /// Expandable bucket table
344 This bucket table can dynamically grow its capacity when necessary
345 up to maximum bucket count.
348 - \p GC - garbage collector
349 - \p Node - node type, must be derived from \p split_list::node
350 - \p Options... - options
353 - \p opt::allocator - allocator used to allocate bucket table. Default is \ref CDS_DEFAULT_ALLOCATOR
354 - \p opt::memory_model - memory model used. Possible types are \p opt::v::sequential_consistent, \p opt::v::relaxed_ordering
356 template <typename GC, typename Node, typename... Options>
357 class expandable_bucket_table
360 struct default_options
362 typedef CDS_DEFAULT_ALLOCATOR allocator;
363 typedef opt::v::relaxed_ordering memory_model;
365 typedef typename opt::make_options< default_options, Options... >::type options;
368 typedef GC gc; ///< Garbage collector
369 typedef Node node_type; ///< Bucket node type
370 typedef atomics::atomic<node_type *> table_entry; ///< Table entry type
372 /// Memory model for atomic operations
373 typedef typename options::memory_model memory_model;
376 typedef atomics::atomic<table_entry *> segment_type; ///< Bucket table segment type
379 /// Bucket table allocator
380 typedef cds::details::Allocator< segment_type, typename options::allocator > bucket_table_allocator;
382 /// Bucket table segment allocator
383 typedef cds::details::Allocator< table_entry, typename options::allocator > segment_allocator;
386 /// Bucket table metrics
388 size_t nSegmentCount; ///< max count of segments in bucket table
389 size_t nSegmentSize; ///< the segment's capacity. The capacity must be power of two.
390 size_t nSegmentSizeLog2; ///< <tt> log2( m_nSegmentSize )</tt>
391 size_t nLoadFactor; ///< load factor
392 size_t nCapacity; ///< max capacity of bucket table
396 : nSegmentCount(1024)
398 , nSegmentSizeLog2( cds::beans::log2( nSegmentSize ) )
400 , nCapacity( nSegmentCount * nSegmentSize )
404 const metrics m_metrics; ///< Dynamic bucket table metrics
407 segment_type * m_Segments; ///< bucket table - array of segments
411 metrics calc_metrics( size_t nItemCount, size_t nLoadFactor )
415 // Calculate m_nSegmentSize and m_nSegmentCount by nItemCount
416 m.nLoadFactor = nLoadFactor > 0 ? nLoadFactor : 1;
418 size_t nBucketCount = (size_t)( ((float) nItemCount) / m.nLoadFactor );
419 if ( nBucketCount <= 2 ) {
423 else if ( nBucketCount <= 1024 ) {
425 m.nSegmentSize = ((size_t) 1) << beans::log2ceil( nBucketCount );
428 nBucketCount = beans::log2ceil( nBucketCount );
430 m.nSegmentSize = ((size_t) 1) << ( nBucketCount / 2 );
431 if ( nBucketCount & 1 )
433 if ( m.nSegmentCount * m.nSegmentSize * m.nLoadFactor < nItemCount )
436 m.nCapacity = m.nSegmentCount * m.nSegmentSize;
437 m.nSegmentSizeLog2 = cds::beans::log2( m.nSegmentSize );
438 assert( m.nSegmentSizeLog2 != 0 ) ; //
442 segment_type * allocate_table()
444 return bucket_table_allocator().NewArray( m_metrics.nSegmentCount, nullptr );
447 void destroy_table( segment_type * pTable )
449 bucket_table_allocator().Delete( pTable, m_metrics.nSegmentCount );
452 table_entry * allocate_segment()
454 return segment_allocator().NewArray( m_metrics.nSegmentSize, nullptr );
457 void destroy_segment( table_entry * pSegment )
459 segment_allocator().Delete( pSegment, m_metrics.nSegmentSize );
464 // m_nSegmentSize must be 2**N
465 assert( cds::beans::is_power2( m_metrics.nSegmentSize ));
466 assert( ( ((size_t) 1) << m_metrics.nSegmentSizeLog2) == m_metrics.nSegmentSize );
468 // m_nSegmentCount must be 2**K
469 assert( cds::beans::is_power2( m_metrics.nSegmentCount ));
471 m_Segments = allocate_table();
477 /// Constructs bucket table for 512K buckets. Load factor is 1.
478 expandable_bucket_table()
479 : m_metrics( calc_metrics( 512 * 1024, 1 ))
484 /// Creates the table with specified capacity rounded up to nearest power-of-two
485 expandable_bucket_table(
486 size_t nItemCount, ///< Max expected item count in split-ordered list
487 size_t nLoadFactor ///< Load factor
489 : m_metrics( calc_metrics( nItemCount, nLoadFactor ))
494 /// Destroys bucket table
495 ~expandable_bucket_table()
497 segment_type * pSegments = m_Segments;
498 for ( size_t i = 0; i < m_metrics.nSegmentCount; ++i ) {
499 table_entry * pEntry = pSegments[i].load(memory_model::memory_order_relaxed);
500 if ( pEntry != nullptr )
501 destroy_segment( pEntry );
503 destroy_table( pSegments );
506 /// Returns head node of the bucket \p nBucket
507 node_type * bucket( size_t nBucket ) const
509 size_t nSegment = nBucket >> m_metrics.nSegmentSizeLog2;
510 assert( nSegment < m_metrics.nSegmentCount );
512 table_entry * pSegment = m_Segments[ nSegment ].load(memory_model::memory_order_acquire);
513 if ( pSegment == nullptr )
514 return nullptr; // uninitialized bucket
515 return pSegment[ nBucket & (m_metrics.nSegmentSize - 1) ].load(memory_model::memory_order_acquire);
518 /// Set \p pNode as a head of bucket \p nBucket
519 void bucket( size_t nBucket, node_type * pNode )
521 size_t nSegment = nBucket >> m_metrics.nSegmentSizeLog2;
522 assert( nSegment < m_metrics.nSegmentCount );
524 segment_type& segment = m_Segments[nSegment];
525 if ( segment.load( memory_model::memory_order_relaxed ) == nullptr ) {
526 table_entry * pNewSegment = allocate_segment();
527 table_entry * pNull = nullptr;
528 if ( !segment.compare_exchange_strong( pNull, pNewSegment, memory_model::memory_order_release, atomics::memory_order_relaxed )) {
529 destroy_segment( pNewSegment );
532 segment.load(memory_model::memory_order_acquire)[ nBucket & (m_metrics.nSegmentSize - 1) ].store( pNode, memory_model::memory_order_release );
535 /// Returns the capacity of the bucket table
536 size_t capacity() const
538 return m_metrics.nCapacity;
541 /// Returns the load factor, i.e. average count of items per bucket
542 size_t load_factor() const
544 return m_metrics.nLoadFactor;
548 /// Split-list node traits
550 This traits is intended for converting between underlying ordered list node type
551 and split-list node type
554 - \p BaseNodeTraits - node traits of base ordered list type
556 template <class BaseNodeTraits>
557 struct node_traits: private BaseNodeTraits
559 typedef BaseNodeTraits base_class; ///< Base ordered list node type
560 typedef typename base_class::value_type value_type; ///< Value type
561 typedef typename base_class::node_type base_node_type; ///< Ordered list node type
562 typedef node<base_node_type> node_type; ///< Spit-list node type
564 /// Convert value reference to node pointer
565 static node_type * to_node_ptr( value_type& v )
567 return static_cast<node_type *>( base_class::to_node_ptr( v ) );
570 /// Convert value pointer to node pointer
571 static node_type * to_node_ptr( value_type * v )
573 return static_cast<node_type *>( base_class::to_node_ptr( v ) );
576 /// Convert value reference to node pointer (const version)
577 static node_type const * to_node_ptr( value_type const& v )
579 return static_cast<node_type const*>( base_class::to_node_ptr( v ) );
582 /// Convert value pointer to node pointer (const version)
583 static node_type const * to_node_ptr( value_type const * v )
585 return static_cast<node_type const *>( base_class::to_node_ptr( v ) );
588 /// Convert node refernce to value pointer
589 static value_type * to_value_ptr( node_type& n )
591 return base_class::to_value_ptr( static_cast<base_node_type &>( n ) );
594 /// Convert node pointer to value pointer
595 static value_type * to_value_ptr( node_type * n )
597 return base_class::to_value_ptr( static_cast<base_node_type *>( n ) );
600 /// Convert node reference to value pointer (const version)
601 static const value_type * to_value_ptr( node_type const & n )
603 return base_class::to_value_ptr( static_cast<base_node_type const &>( n ) );
606 /// Convert node pointer to value pointer (const version)
607 static const value_type * to_value_ptr( node_type const * n )
609 return base_class::to_value_ptr( static_cast<base_node_type const *>( n ) );
615 template <bool Value, typename GC, typename Node, typename... Options>
616 struct bucket_table_selector;
618 template <typename GC, typename Node, typename... Options>
619 struct bucket_table_selector< true, GC, Node, Options...>
621 typedef expandable_bucket_table<GC, Node, Options...> type;
624 template <typename GC, typename Node, typename... Options>
625 struct bucket_table_selector< false, GC, Node, Options...>
627 typedef static_bucket_table<GC, Node, Options...> type;
630 template <typename GC, class Alloc >
631 struct dummy_node_disposer {
632 template <typename Node>
633 void operator()( Node * p )
635 typedef cds::details::Allocator< Node, Alloc > node_deallocator;
636 node_deallocator().Delete( p );
640 template <typename Q>
641 struct search_value_type
646 search_value_type( Q& v, size_t h )
652 template <class OrderedList, class Options>
653 class rebind_list_options
655 typedef OrderedList native_ordered_list;
656 typedef Options options;
658 typedef typename native_ordered_list::gc gc;
659 typedef typename native_ordered_list::key_comparator native_key_comparator;
660 typedef typename native_ordered_list::node_type node_type;
661 typedef typename native_ordered_list::value_type value_type;
662 typedef typename native_ordered_list::node_traits node_traits;
663 typedef typename native_ordered_list::disposer native_disposer;
665 typedef split_list::node<node_type> splitlist_node_type;
668 int operator()( value_type const& v1, value_type const& v2 ) const
670 splitlist_node_type const * n1 = static_cast<splitlist_node_type const *>( node_traits::to_node_ptr( v1 ));
671 splitlist_node_type const * n2 = static_cast<splitlist_node_type const *>( node_traits::to_node_ptr( v2 ));
672 if ( n1->m_nHash != n2->m_nHash )
673 return n1->m_nHash < n2->m_nHash ? -1 : 1;
675 if ( n1->is_dummy() ) {
676 assert( n2->is_dummy() );
680 assert( !n1->is_dummy() && !n2->is_dummy() );
682 return native_key_comparator()( v1, v2 );
685 template <typename Q>
686 int operator()( value_type const& v, search_value_type<Q> const& q ) const
688 splitlist_node_type const * n = static_cast<splitlist_node_type const *>( node_traits::to_node_ptr( v ));
689 if ( n->m_nHash != q.nHash )
690 return n->m_nHash < q.nHash ? -1 : 1;
692 assert( !n->is_dummy() );
693 return native_key_comparator()( v, q.val );
696 template <typename Q>
697 int operator()( search_value_type<Q> const& q, value_type const& v ) const
699 return -operator()( v, q );
703 struct wrapped_disposer
705 void operator()( value_type * v )
707 splitlist_node_type * p = static_cast<splitlist_node_type *>( node_traits::to_node_ptr( v ));
709 dummy_node_disposer<gc, typename options::allocator>()( p );
711 native_disposer()( v );
716 template <typename Less>
717 struct make_compare_from_less: public cds::opt::details::make_comparator_from_less<Less>
719 typedef cds::opt::details::make_comparator_from_less<Less> base_class;
721 template <typename Q>
722 int operator()( value_type const& v, search_value_type<Q> const& q ) const
724 splitlist_node_type const * n = static_cast<splitlist_node_type const *>( node_traits::to_node_ptr( v ));
725 if ( n->m_nHash != q.nHash )
726 return n->m_nHash < q.nHash ? -1 : 1;
728 assert( !n->is_dummy() );
729 return base_class()( v, q.val );
732 template <typename Q>
733 int operator()( search_value_type<Q> const& q, value_type const& v ) const
735 splitlist_node_type const * n = static_cast<splitlist_node_type const *>( node_traits::to_node_ptr( v ));
736 if ( n->m_nHash != q.nHash )
737 return q.nHash < n->m_nHash ? -1 : 1;
739 assert( !n->is_dummy() );
740 return base_class()( q.val, v );
743 template <typename Q1, typename Q2>
744 int operator()( Q1 const& v1, Q2 const& v2 ) const
746 return base_class()( v1, v2 );
750 typedef typename native_ordered_list::template rebind_traits<
751 opt::compare< key_compare >
752 ,opt::disposer< wrapped_disposer >
753 ,opt::boundary_node_type< splitlist_node_type >
757 template <typename OrderedList, bool IsConst>
758 struct select_list_iterator;
760 template <typename OrderedList>
761 struct select_list_iterator<OrderedList, false>
763 typedef typename OrderedList::iterator type;
766 template <typename OrderedList>
767 struct select_list_iterator<OrderedList, true>
769 typedef typename OrderedList::const_iterator type;
772 template <typename NodeTraits, typename OrderedList, bool IsConst>
775 typedef OrderedList ordered_list_type;
777 typedef typename select_list_iterator<ordered_list_type, IsConst>::type list_iterator;
778 typedef NodeTraits node_traits;
781 list_iterator m_itCur;
782 list_iterator m_itEnd;
785 typedef typename list_iterator::value_ptr value_ptr;
786 typedef typename list_iterator::value_ref value_ref;
792 iterator_type( iterator_type const& src )
793 : m_itCur( src.m_itCur )
794 , m_itEnd( src.m_itEnd )
797 // This ctor should be protected...
798 iterator_type( list_iterator itCur, list_iterator itEnd )
803 while ( m_itCur != m_itEnd && node_traits::to_node_ptr( *m_itCur )->is_dummy() )
808 value_ptr operator ->() const
810 return m_itCur.operator->();
813 value_ref operator *() const
815 return m_itCur.operator*();
819 iterator_type& operator ++()
821 if ( m_itCur != m_itEnd ) {
824 } while ( m_itCur != m_itEnd && node_traits::to_node_ptr( *m_itCur )->is_dummy() );
829 iterator_type& operator = (iterator_type const& src)
831 m_itCur = src.m_itCur;
832 m_itEnd = src.m_itEnd;
837 bool operator ==(iterator_type<node_traits, ordered_list_type, C> const& i ) const
839 return m_itCur == i.m_itCur;
842 bool operator !=(iterator_type<node_traits, ordered_list_type, C> const& i ) const
844 return m_itCur != i.m_itCur;
847 } // namespace details
853 /// Reverses bit order in \p nHash
854 static inline size_t reverse_bits( size_t nHash )
856 return bitop::RBO( nHash );
859 static inline size_t regular_hash( size_t nHash )
861 return reverse_bits( nHash ) | size_t(1);
864 static inline size_t dummy_hash( size_t nHash )
866 return reverse_bits( nHash ) & ~size_t(1);
870 } // namespace split_list
873 // Forward declaration
874 template <class GC, class OrderedList, class Traits = split_list::traits>
878 }} // namespace cds::intrusive
880 #endif // #ifndef __CDS_INTRUSIVE_DETAILS_SPLIT_LIST_BASE_H