From: khizmax Date: Sat, 29 Oct 2016 14:31:54 +0000 (+0300) Subject: Removed redundant spaces X-Git-Tag: v2.2.0~83 X-Git-Url: http://plrg.eecs.uci.edu/git/?p=libcds.git;a=commitdiff_plain;h=2402fb1beb25ec532cea91c8dfbb9425eb5bdf48 Removed redundant spaces --- diff --git a/cds/algo/backoff_strategy.h b/cds/algo/backoff_strategy.h index 03f95c60..1d191fda 100644 --- a/cds/algo/backoff_strategy.h +++ b/cds/algo/backoff_strategy.h @@ -88,7 +88,7 @@ namespace cds { {} template - bool operator()(Predicate pr) const CDS_NOEXCEPT_( noexcept(std::declval()() )) + bool operator()(Predicate pr) const CDS_NOEXCEPT_( noexcept(std::declval()())) { return pr(); } @@ -107,9 +107,9 @@ namespace cds { } template - bool operator()(Predicate pr) const CDS_NOEXCEPT_( noexcept(std::declval()() )) + bool operator()(Predicate pr) const CDS_NOEXCEPT_( noexcept(std::declval()())) { - if ( pr() ) + if ( pr()) return true; operator()(); return false; @@ -135,9 +135,9 @@ namespace cds { } template - bool operator()(Predicate pr) const CDS_NOEXCEPT_( noexcept(std::declval()() )) + bool operator()(Predicate pr) const CDS_NOEXCEPT_( noexcept(std::declval()())) { - if ( pr() ) + if ( pr()) return true; operator()(); return false; @@ -166,9 +166,9 @@ namespace cds { } template - bool operator()(Predicate pr) const CDS_NOEXCEPT_(noexcept(std::declval()() )) + bool operator()(Predicate pr) const CDS_NOEXCEPT_(noexcept(std::declval()())) { - if ( pr() ) + if ( pr()) return true; operator()(); return false; @@ -293,11 +293,11 @@ namespace cds { } template - bool operator()( Predicate pr ) CDS_NOEXCEPT_( noexcept(std::declval()()) && noexcept(std::declval()()) && noexcept(std::declval()() )) + bool operator()( Predicate pr ) CDS_NOEXCEPT_( noexcept(std::declval()()) && noexcept(std::declval()()) && noexcept(std::declval()())) { if ( m_nExpCur <= m_nExpMax ) { for ( size_t n = 0; n < m_nExpCur; ++n ) { - if ( m_bkSpin(pr) ) + if ( m_bkSpin(pr)) return true; } m_nExpCur *= 2; @@ -307,7 +307,7 @@ namespace cds { return false; } - void reset() CDS_NOEXCEPT_( noexcept( std::declval().reset() ) && noexcept( std::declval().reset() )) + void reset() CDS_NOEXCEPT_( noexcept( std::declval().reset()) && noexcept( std::declval().reset())) { m_nExpCur = m_nExpMin; m_bkSpin.reset(); @@ -403,7 +403,7 @@ namespace cds { bool operator()(Predicate pr) const { for ( unsigned int i = 0; i < m_nTimeout; i += 2 ) { - if ( pr() ) + if ( pr()) return true; std::this_thread::sleep_for( duration_type( 2 )); } diff --git a/cds/algo/flat_combining/kernel.h b/cds/algo/flat_combining/kernel.h index ece696f0..f8dd398c 100644 --- a/cds/algo/flat_combining/kernel.h +++ b/cds/algo/flat_combining/kernel.h @@ -329,7 +329,7 @@ namespace cds { namespace algo { /// Marks publication record for the current thread as empty void release_record( publication_record_type * pRec ) { - assert( pRec->is_done() ); + assert( pRec->is_done()); pRec->nRequest.store( req_EmptyRecord, memory_model::memory_order_release ); } @@ -410,7 +410,7 @@ namespace cds { namespace algo { /// Marks \p rec as executed /** This function should be called by container if \p batch_combine mode is used. - For usual combining (see \p combine() ) this function is excess. + For usual combining (see \p combine()) this function is excess. */ void operation_done( publication_record& rec ) { @@ -606,7 +606,7 @@ namespace cds { namespace algo { pRec->nState.store( active, memory_model::memory_order_release ); // Insert record to publication list - if ( m_pHead != static_cast(pRec) ) { + if ( m_pHead != static_cast(pRec)) { publication_record * p = m_pHead->pNext.load(memory_model::memory_order_relaxed); if ( p != static_cast( pRec )) { do { @@ -630,9 +630,9 @@ namespace cds { namespace algo { template void try_combining( Container& owner, publication_record_type* pRec ) { - if ( m_Mutex.try_lock() ) { + if ( m_Mutex.try_lock()) { // The thread becomes a combiner - lock_guard l( m_Mutex, std::adopt_lock_t() ); + lock_guard l( m_Mutex, std::adopt_lock_t()); // The record pRec can be excluded from publication list. Re-publish it republish( pRec ); @@ -642,9 +642,9 @@ namespace cds { namespace algo { } else { // There is another combiner, wait while it executes our request - if ( !wait_for_combining( pRec ) ) { + if ( !wait_for_combining( pRec )) { // The thread becomes a combiner - lock_guard l( m_Mutex, std::adopt_lock_t() ); + lock_guard l( m_Mutex, std::adopt_lock_t()); // The record pRec can be excluded from publication list. Re-publish it republish( pRec ); @@ -658,9 +658,9 @@ namespace cds { namespace algo { template void try_batch_combining( Container& owner, publication_record_type * pRec ) { - if ( m_Mutex.try_lock() ) { + if ( m_Mutex.try_lock()) { // The thread becomes a combiner - lock_guard l( m_Mutex, std::adopt_lock_t() ); + lock_guard l( m_Mutex, std::adopt_lock_t()); // The record pRec can be excluded from publication list. Re-publish it republish( pRec ); @@ -670,9 +670,9 @@ namespace cds { namespace algo { } else { // There is another combiner, wait while it executes our request - if ( !wait_for_combining( pRec ) ) { + if ( !wait_for_combining( pRec )) { // The thread becomes a combiner - lock_guard l( m_Mutex, std::adopt_lock_t() ); + lock_guard l( m_Mutex, std::adopt_lock_t()); // The record pRec can be excluded from publication list. Re-publish it republish( pRec ); @@ -687,7 +687,7 @@ namespace cds { namespace algo { void combining( Container& owner ) { // The thread is a combiner - assert( !m_Mutex.try_lock() ); + assert( !m_Mutex.try_lock()); unsigned int const nCurAge = m_nCount.fetch_add( 1, memory_model::memory_order_relaxed ) + 1; @@ -716,7 +716,7 @@ namespace cds { namespace algo { case active: if ( p->op() >= req_Operation ) { p->nAge.store( nCurAge, memory_model::memory_order_release ); - owner.fc_apply( static_cast(p) ); + owner.fc_apply( static_cast(p)); operation_done( *p ); bOpDone = true; } @@ -743,12 +743,12 @@ namespace cds { namespace algo { void batch_combining( Container& owner ) { // The thread is a combiner - assert( !m_Mutex.try_lock() ); + assert( !m_Mutex.try_lock()); unsigned int const nCurAge = m_nCount.fetch_add( 1, memory_model::memory_order_relaxed ) + 1; for ( unsigned int nPass = 0; nPass < m_nCombinePassCount; ++nPass ) - owner.fc_process( begin(), end() ); + owner.fc_process( begin(), end()); combining_pass( owner, nCurAge ); m_Stat.onCombining(); @@ -771,7 +771,7 @@ namespace cds { namespace algo { if ( m_waitStrategy.wait( *this, *pRec )) m_Stat.onWakeupByNotifying(); - if ( m_Mutex.try_lock() ) { + if ( m_Mutex.try_lock()) { if ( pRec->op( memory_model::memory_order_acquire ) == req_Response ) { // Operation is done m_Mutex.unlock(); diff --git a/cds/algo/split_bitstring.h b/cds/algo/split_bitstring.h index 239b9dd3..738accbb 100644 --- a/cds/algo/split_bitstring.h +++ b/cds/algo/split_bitstring.h @@ -101,7 +101,7 @@ namespace cds { namespace algo { */ uint_type cut( size_t nBits ) { - assert( !eos() ); + assert( !eos()); assert( nBits <= c_nBitPerInt ); assert( m_offset + nBits <= c_nBitPerHash ); # ifdef _DEBUG @@ -145,7 +145,7 @@ namespace cds { namespace algo { */ uint_type safe_cut( size_t nBits ) { - if ( eos() ) + if ( eos()) return 0; assert( nBits <= sizeof(uint_type) * c_nBitPerByte ); diff --git a/cds/compiler/gcc/ia64/bitop.h b/cds/compiler/gcc/ia64/bitop.h index e213b621..4363081d 100644 --- a/cds/compiler/gcc/ia64/bitop.h +++ b/cds/compiler/gcc/ia64/bitop.h @@ -49,7 +49,7 @@ namespace cds { x |= x >> 16; uint64_t nRes; - asm __volatile__( "popcnt %0=%1\n\t" : "=r" (nRes) : "r" (x) ); + asm __volatile__( "popcnt %0=%1\n\t" : "=r" (nRes) : "r" (x)); return (int) nRes; } diff --git a/cds/compiler/icl/defs.h b/cds/compiler/icl/defs.h index 2c16c5ad..2a5cae3b 100644 --- a/cds/compiler/icl/defs.h +++ b/cds/compiler/icl/defs.h @@ -121,9 +121,9 @@ // Alignment macro #if CDS_OS_INTERFACE == CDS_OSI_WINDOWS -# define CDS_TYPE_ALIGNMENT(n) __declspec( align(n) ) -# define CDS_DATA_ALIGNMENT(n) __declspec( align(n) ) -# define CDS_CLASS_ALIGNMENT(n) __declspec( align(n) ) +# define CDS_TYPE_ALIGNMENT(n) __declspec( align(n)) +# define CDS_DATA_ALIGNMENT(n) __declspec( align(n)) +# define CDS_CLASS_ALIGNMENT(n) __declspec( align(n)) #else # define CDS_TYPE_ALIGNMENT(n) __attribute__ ((aligned (n))) # define CDS_CLASS_ALIGNMENT(n) __attribute__ ((aligned (n))) diff --git a/cds/compiler/vc/amd64/cxx11_atomic.h b/cds/compiler/vc/amd64/cxx11_atomic.h index 83aac1d3..27a6f669 100644 --- a/cds/compiler/vc/amd64/cxx11_atomic.h +++ b/cds/compiler/vc/amd64/cxx11_atomic.h @@ -206,7 +206,7 @@ namespace cds { namespace cxx11_atomic { return expected == prev; # else // VC 2008 - unsigned int * pnDest = (unsigned int *)( ((unsigned __int64) pDest) & ~(unsigned __int64(3)) ); + unsigned int * pnDest = (unsigned int *)( ((unsigned __int64) pDest) & ~(unsigned __int64(3))); unsigned int nOffset = ((unsigned __int64) pDest) & 3; unsigned int nExpected; unsigned int nDesired; @@ -545,7 +545,7 @@ namespace cds { namespace cxx11_atomic { static inline T * exchange_ptr( T * volatile * pDest, T * v, memory_order /*order*/ ) CDS_NOEXCEPT { static_assert( sizeof(T *) == sizeof(void *), "Illegal size of operand" ); - return (T *) _InterlockedExchangePointer( (void * volatile *) pDest, reinterpret_cast(v) ); + return (T *) _InterlockedExchangePointer( (void * volatile *) pDest, reinterpret_cast(v)); } template diff --git a/cds/compiler/vc/defs.h b/cds/compiler/vc/defs.h index 6d8aa406..1b00f6ff 100644 --- a/cds/compiler/vc/defs.h +++ b/cds/compiler/vc/defs.h @@ -148,9 +148,9 @@ // ************************************************* // Alignment macro -#define CDS_TYPE_ALIGNMENT(n) __declspec( align(n) ) -#define CDS_DATA_ALIGNMENT(n) __declspec( align(n) ) -#define CDS_CLASS_ALIGNMENT(n) __declspec( align(n) ) +#define CDS_TYPE_ALIGNMENT(n) __declspec( align(n)) +#define CDS_DATA_ALIGNMENT(n) __declspec( align(n)) +#define CDS_CLASS_ALIGNMENT(n) __declspec( align(n)) // Attributes #if CDS_COMPILER_VERSION >= CDS_COMPILER_MSVC14 diff --git a/cds/compiler/vc/x86/cxx11_atomic.h b/cds/compiler/vc/x86/cxx11_atomic.h index 5f42ca2d..d9dc799e 100644 --- a/cds/compiler/vc/x86/cxx11_atomic.h +++ b/cds/compiler/vc/x86/cxx11_atomic.h @@ -518,7 +518,7 @@ namespace cds { namespace cxx11_atomic { { static_assert( sizeof(T *) == sizeof(void *), "Illegal operand size" ); return (T *) _InterlockedExchange( (long volatile *) pDest, (uintptr_t) v ); - //return (T *) _InterlockedExchangePointer( (void * volatile *) pDest, reinterpret_cast(v) ); + //return (T *) _InterlockedExchangePointer( (void * volatile *) pDest, reinterpret_cast(v)); } template diff --git a/cds/container/basket_queue.h b/cds/container/basket_queue.h index e3bceaf6..0192f483 100644 --- a/cds/container/basket_queue.h +++ b/cds/container/basket_queue.h @@ -329,7 +329,7 @@ namespace cds { namespace container { bool enqueue( value_type&& val ) { scoped_node_ptr p( alloc_node_move( std::move( val ))); - if ( base_class::enqueue( *p ) ) { + if ( base_class::enqueue( *p )) { p.release(); return true; } @@ -349,7 +349,7 @@ namespace cds { namespace container { template bool enqueue_with( Func f ) { - scoped_node_ptr p( alloc_node() ); + scoped_node_ptr p( alloc_node()); f( p->m_value ); if ( base_class::enqueue( *p )) { p.release(); diff --git a/cds/container/cuckoo_map.h b/cds/container/cuckoo_map.h index d990092f..89eca7c0 100644 --- a/cds/container/cuckoo_map.h +++ b/cds/container/cuckoo_map.h @@ -56,17 +56,17 @@ namespace cds { namespace container { template node_type( K const& key ) - : m_val( std::make_pair( key_type(key), mapped_type() )) + : m_val( std::make_pair( key_type(key), mapped_type())) {} template node_type( K const& key, Q const& v ) - : m_val( std::make_pair( key_type(key), mapped_type(v) )) + : m_val( std::make_pair( key_type(key), mapped_type(v))) {} template node_type( K&& key, Args&&... args ) - : m_val( std::forward(key), std::move( mapped_type(std::forward(args)...)) ) + : m_val( std::forward(key), std::move( mapped_type(std::forward(args)...))) {} }; @@ -401,7 +401,7 @@ namespace cds { namespace container { CuckooMap( hash_tuple_type&& h ///< hash functor tuple of type std::tuple where n == \ref c_nArity ) - : base_class( std::forward(h) ) + : base_class( std::forward(h)) {} /// Constructs a map with given probe set properties and hash functor tuple (move semantics) @@ -415,7 +415,7 @@ namespace cds { namespace container { , unsigned int nProbesetThreshold ///< probe set threshold, nProbesetThreshold < nProbesetSize. If 0, nProbesetThreshold = nProbesetSize - 1 , hash_tuple_type&& h ///< hash functor tuple of type std::tuple where n == \ref c_nArity ) - : base_class( nInitialSize, nProbesetSize, nProbesetThreshold, std::forward(h) ) + : base_class( nInitialSize, nProbesetSize, nProbesetThreshold, std::forward(h)) {} /// Destructor clears the map @@ -629,7 +629,7 @@ namespace cds { namespace container { bool erase_with( K const& key, Predicate pred, Func f ) { CDS_UNUSED( pred ); - node_type * pNode = base_class::erase_with( key, cds::details::predicate_wrapper() ); + node_type * pNode = base_class::erase_with( key, cds::details::predicate_wrapper()); if ( pNode ) { f( pNode->m_val ); free_node( pNode ); @@ -705,7 +705,7 @@ namespace cds { namespace container { bool contains( K const& key, Predicate pred ) { CDS_UNUSED( pred ); - return base_class::contains( key, cds::details::predicate_wrapper() ); + return base_class::contains( key, cds::details::predicate_wrapper()); } //@cond template @@ -719,7 +719,7 @@ namespace cds { namespace container { /// Clears the map void clear() { - base_class::clear_and_dispose( node_disposer() ); + base_class::clear_and_dispose( node_disposer()); } /// Checks if the map is empty diff --git a/cds/container/cuckoo_set.h b/cds/container/cuckoo_set.h index bebbb47d..9229432e 100644 --- a/cds/container/cuckoo_set.h +++ b/cds/container/cuckoo_set.h @@ -474,7 +474,7 @@ namespace cds { namespace container { CuckooSet( hash_tuple_type&& h ///< hash functor tuple of type std::tuple where n == \ref c_nArity ) - : base_class( std::forward(h) ) + : base_class( std::forward(h)) {} /// Constructs the set object with given probe set properties and hash functor tuple (move semantics) @@ -488,7 +488,7 @@ namespace cds { namespace container { , unsigned int nProbesetThreshold ///< probe set threshold, nProbesetThreshold < nProbesetSize. If 0, nProbesetThreshold = nProbesetSize - 1 , hash_tuple_type&& h ///< hash functor tuple of type std::tuple where n == \ref c_nArity ) - : base_class( nInitialSize, nProbesetSize, nProbesetThreshold, std::forward(h) ) + : base_class( nInitialSize, nProbesetSize, nProbesetThreshold, std::forward(h)) {} /// Destructor clears the set @@ -638,7 +638,7 @@ namespace cds { namespace container { bool erase_with( Q const& key, Predicate pred ) { CDS_UNUSED( pred ); - node_type * pNode = base_class::erase_with( key, typename maker::template predicate_wrapper() ); + node_type * pNode = base_class::erase_with( key, typename maker::template predicate_wrapper()); if ( pNode ) { free_node( pNode ); return true; @@ -685,7 +685,7 @@ namespace cds { namespace container { bool erase_with( Q const& key, Predicate pred, Func f ) { CDS_UNUSED( pred ); - node_type * pNode = base_class::erase_with( key, typename maker::template predicate_wrapper() ); + node_type * pNode = base_class::erase_with( key, typename maker::template predicate_wrapper()); if ( pNode ) { f( pNode->m_val ); free_node( pNode ); @@ -799,7 +799,7 @@ namespace cds { namespace container { */ void clear() { - return base_class::clear_and_dispose( node_disposer() ); + return base_class::clear_and_dispose( node_disposer()); } /// Checks if the set is empty diff --git a/cds/container/details/bronson_avltree_base.h b/cds/container/details/bronson_avltree_base.h index a1343886..822c204b 100644 --- a/cds/container/details/bronson_avltree_base.h +++ b/cds/container/details/bronson_avltree_base.h @@ -137,7 +137,7 @@ namespace cds { namespace container { void wait_until_shrink_completed( atomics::memory_order order ) const { BackOff bkoff; - while ( is_shrinking( order ) ) + while ( is_shrinking( order )) bkoff(); } @@ -185,14 +185,14 @@ namespace cds { namespace container { template node( Q&& key ) : base_class() - , m_key( std::forward( key ) ) + , m_key( std::forward( key )) , m_pNextRemoved( nullptr ) {} template node( Q&& key, int nHeight, version_type version, node * pParent, node * pLeft, node * pRight ) : base_class( nHeight, version, pParent, pLeft, pRight ) - , m_key( std::forward( key ) ) + , m_key( std::forward( key )) , m_pNextRemoved( nullptr ) {} //@endcond diff --git a/cds/container/details/ellen_bintree_base.h b/cds/container/details/ellen_bintree_base.h index b53c4de4..6f963a4d 100644 --- a/cds/container/details/ellen_bintree_base.h +++ b/cds/container/details/ellen_bintree_base.h @@ -112,13 +112,13 @@ namespace cds { namespace container { /// Initializes key field, value if default-constructed template map_node( K const& key ) - : m_Value( std::make_pair( key_type(key), mapped_type() )) + : m_Value( std::make_pair( key_type(key), mapped_type())) {} /// Initializes key and value fields template map_node( K const& key, Q const& v ) - : m_Value( std::make_pair(key_type(key), mapped_type(v) )) + : m_Value( std::make_pair(key_type(key), mapped_type(v))) {} }; diff --git a/cds/container/details/feldman_hashmap_base.h b/cds/container/details/feldman_hashmap_base.h index 1be683e6..ae2f72a3 100644 --- a/cds/container/details/feldman_hashmap_base.h +++ b/cds/container/details/feldman_hashmap_base.h @@ -292,7 +292,7 @@ namespace cds { namespace container { template node_type( hasher /*h*/, Q&& key, Args&&... args ) - : m_Value( std::make_pair( key_type( std::forward( key )), mapped_type( std::forward(args)...) )) + : m_Value( std::make_pair( key_type( std::forward( key )), mapped_type( std::forward(args)...))) {} }; diff --git a/cds/container/details/make_lazy_kvlist.h b/cds/container/details/make_lazy_kvlist.h index 2c974c93..dbe53f2a 100644 --- a/cds/container/details/make_lazy_kvlist.h +++ b/cds/container/details/make_lazy_kvlist.h @@ -53,12 +53,12 @@ namespace cds { namespace container { value_type m_Data; node_type( key_type const& key ) - : m_Data( key, mapped_type() ) + : m_Data( key, mapped_type()) {} template node_type( Q const& key ) - : m_Data( key_type( key ), mapped_type() ) + : m_Data( key_type( key ), mapped_type()) {} template @@ -72,7 +72,7 @@ namespace cds { namespace container { template node_type( key_type const& key, R const& value ) - : m_Data( key, mapped_type( value ) ) + : m_Data( key, mapped_type( value )) {} template @@ -87,7 +87,7 @@ namespace cds { namespace container { template node_type( Ky&& key, Args&&... args ) - : m_Data( key_type( std::forward( key )), std::move( mapped_type( std::forward( args )... ) ) ) + : m_Data( key_type( std::forward( key )), std::move( mapped_type( std::forward( args )... )) ) {} }; diff --git a/cds/container/details/make_michael_kvlist.h b/cds/container/details/make_michael_kvlist.h index 9de92342..c28521fa 100644 --- a/cds/container/details/make_michael_kvlist.h +++ b/cds/container/details/make_michael_kvlist.h @@ -53,12 +53,12 @@ namespace cds { namespace container { pair_type m_Data; node_type( key_type const& key ) - : m_Data( key, value_type() ) + : m_Data( key, value_type()) {} template node_type( Q const& key ) - : m_Data( key_type(key), value_type() ) + : m_Data( key_type(key), value_type()) {} template diff --git a/cds/container/details/make_skip_list_map.h b/cds/container/details/make_skip_list_map.h index 5c808a3b..cc34b391 100644 --- a/cds/container/details/make_skip_list_map.h +++ b/cds/container/details/make_skip_list_map.h @@ -58,7 +58,7 @@ namespace cds { namespace container { namespace details { template node_type( unsigned int nHeight, atomic_marked_ptr * pTower, Q const& key ) - : m_Value( std::make_pair( key, mapped_type() )) + : m_Value( std::make_pair( key, mapped_type())) { init_tower( nHeight, pTower ); } diff --git a/cds/container/details/make_split_list_set_iterable_list.h b/cds/container/details/make_split_list_set_iterable_list.h index 9bb3a256..f38edb5e 100644 --- a/cds/container/details/make_split_list_set_iterable_list.h +++ b/cds/container/details/make_split_list_set_iterable_list.h @@ -114,7 +114,7 @@ namespace cds { namespace container { namespace details { size_t operator()(node_type const& v ) const { - return base_class::operator()( key_accessor()( v.m_Value ) ); + return base_class::operator()( key_accessor()( v.m_Value )); } template size_t operator()( Q const& k ) const diff --git a/cds/container/details/make_split_list_set_michael_list.h b/cds/container/details/make_split_list_set_michael_list.h index 14355074..73ff2614 100644 --- a/cds/container/details/make_split_list_set_michael_list.h +++ b/cds/container/details/make_split_list_set_michael_list.h @@ -119,7 +119,7 @@ namespace cds { namespace container { namespace details { size_t operator()(node_type const& v ) const { - return base_class::operator()( key_accessor()( v.m_Value ) ); + return base_class::operator()( key_accessor()( v.m_Value )); } template size_t operator()( Q const& k ) const diff --git a/cds/container/details/skip_list_base.h b/cds/container/details/skip_list_base.h index 383f7ef5..a737ec42 100644 --- a/cds/container/details/skip_list_base.h +++ b/cds/container/details/skip_list_base.h @@ -173,7 +173,7 @@ namespace cds { namespace container { static unsigned char * alloc_space( unsigned int nHeight ) { if ( nHeight > 1 ) { - unsigned char * pMem = tower_allocator_type().allocate( node_size(nHeight) ); + unsigned char * pMem = tower_allocator_type().allocate( node_size(nHeight)); // check proper alignments assert( (((uintptr_t) pMem) & (alignof(node_type) - 1)) == 0 ); diff --git a/cds/container/ellen_bintree_map_rcu.h b/cds/container/ellen_bintree_map_rcu.h index 19e78617..e7f4c90f 100644 --- a/cds/container/ellen_bintree_map_rcu.h +++ b/cds/container/ellen_bintree_map_rcu.h @@ -438,7 +438,7 @@ namespace cds { namespace container { { CDS_UNUSED( pred ); return exempt_ptr( base_class::extract_with_( key, - cds::details::predicate_wrapper< leaf_node, Less, typename maker::key_accessor >() )); + cds::details::predicate_wrapper< leaf_node, Less, typename maker::key_accessor >())); } /// Find the key \p key @@ -512,7 +512,7 @@ namespace cds { namespace container { bool contains( K const& key, Less pred ) { CDS_UNUSED( pred ); - return base_class::contains( key, cds::details::predicate_wrapper< leaf_node, Less, typename maker::key_accessor >() ); + return base_class::contains( key, cds::details::predicate_wrapper< leaf_node, Less, typename maker::key_accessor >()); } //@cond template diff --git a/cds/container/ellen_bintree_set_rcu.h b/cds/container/ellen_bintree_set_rcu.h index 57f6ea8c..1723e80a 100644 --- a/cds/container/ellen_bintree_set_rcu.h +++ b/cds/container/ellen_bintree_set_rcu.h @@ -204,7 +204,7 @@ namespace cds { namespace container { bool insert( Q const& val ) { scoped_node_ptr sp( cxx_leaf_node_allocator().New( val )); - if ( base_class::insert( *sp.get() )) { + if ( base_class::insert( *sp.get())) { sp.release(); return true; } @@ -297,7 +297,7 @@ namespace cds { namespace container { bool emplace( Args&&... args ) { scoped_node_ptr sp( cxx_leaf_node_allocator().MoveNew( std::forward(args)... )); - if ( base_class::insert( *sp.get() )) { + if ( base_class::insert( *sp.get())) { sp.release(); return true; } @@ -448,7 +448,7 @@ namespace cds { namespace container { { CDS_UNUSED( pred ); return exempt_ptr( base_class::extract_with_( key, - cds::details::predicate_wrapper< leaf_node, Less, typename maker::value_accessor >() )); + cds::details::predicate_wrapper< leaf_node, Less, typename maker::value_accessor >())); } /// Find the key \p key @@ -600,7 +600,7 @@ namespace cds { namespace container { this sequence \code set.clear(); - assert( set.empty() ); + assert( set.empty()); \endcode the assertion could be raised. diff --git a/cds/container/fcdeque.h b/cds/container/fcdeque.h index ce169108..1a27fea6 100644 --- a/cds/container/fcdeque.h +++ b/cds/container/fcdeque.h @@ -208,7 +208,7 @@ namespace cds { namespace container { else m_FlatCombining.combine( op_push_front, pRec, *this ); - assert( pRec->is_done() ); + assert( pRec->is_done()); m_FlatCombining.release_record( pRec ); m_FlatCombining.internal_statistics().onPushFront(); return true; @@ -230,7 +230,7 @@ namespace cds { namespace container { else m_FlatCombining.combine( op_push_front_move, pRec, *this ); - assert( pRec->is_done() ); + assert( pRec->is_done()); m_FlatCombining.release_record( pRec ); m_FlatCombining.internal_statistics().onPushFrontMove(); return true; @@ -252,7 +252,7 @@ namespace cds { namespace container { else m_FlatCombining.combine( op_push_back, pRec, *this ); - assert( pRec->is_done() ); + assert( pRec->is_done()); m_FlatCombining.release_record( pRec ); m_FlatCombining.internal_statistics().onPushBack(); return true; @@ -274,7 +274,7 @@ namespace cds { namespace container { else m_FlatCombining.combine( op_push_back_move, pRec, *this ); - assert( pRec->is_done() ); + assert( pRec->is_done()); m_FlatCombining.release_record( pRec ); m_FlatCombining.internal_statistics().onPushBackMove(); return true; @@ -297,7 +297,7 @@ namespace cds { namespace container { else m_FlatCombining.combine( op_pop_front, pRec, *this ); - assert( pRec->is_done() ); + assert( pRec->is_done()); m_FlatCombining.release_record( pRec ); m_FlatCombining.internal_statistics().onPopFront( pRec->bEmpty ); return !pRec->bEmpty; @@ -320,7 +320,7 @@ namespace cds { namespace container { else m_FlatCombining.combine( op_pop_back, pRec, *this ); - assert( pRec->is_done() ); + assert( pRec->is_done()); m_FlatCombining.release_record( pRec ); m_FlatCombining.internal_statistics().onPopBack( pRec->bEmpty ); return !pRec->bEmpty; @@ -336,7 +336,7 @@ namespace cds { namespace container { else m_FlatCombining.combine( op_clear, pRec, *this ); - assert( pRec->is_done() ); + assert( pRec->is_done()); m_FlatCombining.release_record( pRec ); } @@ -384,22 +384,22 @@ namespace cds { namespace container { // this function is called under FC mutex, so switch TSan off CDS_TSAN_ANNOTATE_IGNORE_RW_BEGIN; - switch ( pRec->op() ) { + switch ( pRec->op()) { case op_push_front: assert( pRec->pValPush ); - m_Deque.push_front( *(pRec->pValPush) ); + m_Deque.push_front( *(pRec->pValPush)); break; case op_push_front_move: assert( pRec->pValPush ); - m_Deque.push_front( std::move( *(pRec->pValPush )) ); + m_Deque.push_front( std::move( *(pRec->pValPush ))); break; case op_push_back: assert( pRec->pValPush ); - m_Deque.push_back( *(pRec->pValPush) ); + m_Deque.push_back( *(pRec->pValPush)); break; case op_push_back_move: assert( pRec->pValPush ); - m_Deque.push_back( std::move( *(pRec->pValPush )) ); + m_Deque.push_back( std::move( *(pRec->pValPush ))); break; case op_pop_front: assert( pRec->pValPop ); @@ -418,7 +418,7 @@ namespace cds { namespace container { } break; case op_clear: - while ( !m_Deque.empty() ) + while ( !m_Deque.empty()) m_Deque.pop_front(); break; default: @@ -437,10 +437,10 @@ namespace cds { namespace container { CDS_TSAN_ANNOTATE_IGNORE_RW_BEGIN; for ( fc_iterator it = itBegin, itPrev = itEnd; it != itEnd; ++it ) { - switch ( it->op() ) { + switch ( it->op()) { case op_push_front: if ( itPrev != itEnd - && (itPrev->op() == op_pop_front || (m_Deque.empty() && itPrev->op() == op_pop_back)) ) + && (itPrev->op() == op_pop_front || (m_Deque.empty() && itPrev->op() == op_pop_back))) { collide( *it, *itPrev ); itPrev = itEnd; @@ -460,7 +460,7 @@ namespace cds { namespace container { break; case op_push_back: if ( itPrev != itEnd - && (itPrev->op() == op_pop_back || (m_Deque.empty() && itPrev->op() == op_pop_front)) ) + && (itPrev->op() == op_pop_back || (m_Deque.empty() && itPrev->op() == op_pop_front))) { collide( *it, *itPrev ); itPrev = itEnd; @@ -480,8 +480,8 @@ namespace cds { namespace container { break; case op_pop_front: if ( itPrev != itEnd ) { - if ( m_Deque.empty() ) { - switch ( itPrev->op() ) { + if ( m_Deque.empty()) { + switch ( itPrev->op()) { case op_push_back: collide( *itPrev, *it ); itPrev = itEnd; @@ -496,7 +496,7 @@ namespace cds { namespace container { } } else { - switch ( itPrev->op() ) { + switch ( itPrev->op()) { case op_push_front: collide( *itPrev, *it ); itPrev = itEnd; @@ -516,8 +516,8 @@ namespace cds { namespace container { break; case op_pop_back: if ( itPrev != itEnd ) { - if ( m_Deque.empty() ) { - switch ( itPrev->op() ) { + if ( m_Deque.empty()) { + switch ( itPrev->op()) { case op_push_front: collide( *itPrev, *it ); itPrev = itEnd; @@ -532,7 +532,7 @@ namespace cds { namespace container { } } else { - switch ( itPrev->op() ) { + switch ( itPrev->op()) { case op_push_back: collide( *itPrev, *it ); itPrev = itEnd; diff --git a/cds/container/fcpriority_queue.h b/cds/container/fcpriority_queue.h index 13bcde07..d8d16462 100644 --- a/cds/container/fcpriority_queue.h +++ b/cds/container/fcpriority_queue.h @@ -183,7 +183,7 @@ namespace cds { namespace container { m_FlatCombining.combine( op_push, pRec, *this ); - assert( pRec->is_done() ); + assert( pRec->is_done()); m_FlatCombining.release_record( pRec ); m_FlatCombining.internal_statistics().onPush(); return true; @@ -202,7 +202,7 @@ namespace cds { namespace container { m_FlatCombining.combine( op_push_move, pRec, *this ); - assert( pRec->is_done() ); + assert( pRec->is_done()); m_FlatCombining.release_record( pRec ); m_FlatCombining.internal_statistics().onPushMove(); return true; @@ -222,7 +222,7 @@ namespace cds { namespace container { m_FlatCombining.combine( op_pop, pRec, *this ); - assert( pRec->is_done() ); + assert( pRec->is_done()); m_FlatCombining.release_record( pRec ); m_FlatCombining.internal_statistics().onPop( pRec->bEmpty ); return !pRec->bEmpty; @@ -235,7 +235,7 @@ namespace cds { namespace container { m_FlatCombining.combine( op_clear, pRec, *this ); - assert( pRec->is_done() ); + assert( pRec->is_done()); m_FlatCombining.release_record( pRec ); } @@ -282,14 +282,14 @@ namespace cds { namespace container { // this function is called under FC mutex, so switch TSan off CDS_TSAN_ANNOTATE_IGNORE_RW_BEGIN; - switch ( pRec->op() ) { + switch ( pRec->op()) { case op_push: assert( pRec->pValPush ); - m_PQueue.push( *(pRec->pValPush) ); + m_PQueue.push( *(pRec->pValPush)); break; case op_push_move: assert( pRec->pValPush ); - m_PQueue.push( std::move( *(pRec->pValPush )) ); + m_PQueue.push( std::move( *(pRec->pValPush ))); break; case op_pop: assert( pRec->pValPop ); @@ -300,7 +300,7 @@ namespace cds { namespace container { } break; case op_clear: - while ( !m_PQueue.empty() ) + while ( !m_PQueue.empty()) m_PQueue.pop(); break; default: diff --git a/cds/container/fcqueue.h b/cds/container/fcqueue.h index 03daa014..7da19de8 100644 --- a/cds/container/fcqueue.h +++ b/cds/container/fcqueue.h @@ -194,7 +194,7 @@ namespace cds { namespace container { else m_FlatCombining.combine( op_enq, pRec, *this ); - assert( pRec->is_done() ); + assert( pRec->is_done()); m_FlatCombining.release_record( pRec ); m_FlatCombining.internal_statistics().onEnqueue(); return true; @@ -220,7 +220,7 @@ namespace cds { namespace container { else m_FlatCombining.combine( op_enq_move, pRec, *this ); - assert( pRec->is_done() ); + assert( pRec->is_done()); m_FlatCombining.release_record( pRec ); m_FlatCombining.internal_statistics().onEnqMove(); @@ -247,7 +247,7 @@ namespace cds { namespace container { else m_FlatCombining.combine( op_deq, pRec, *this ); - assert( pRec->is_done() ); + assert( pRec->is_done()); m_FlatCombining.release_record( pRec ); m_FlatCombining.internal_statistics().onDequeue( pRec->bEmpty ); @@ -270,7 +270,7 @@ namespace cds { namespace container { else m_FlatCombining.combine( op_clear, pRec, *this ); - assert( pRec->is_done() ); + assert( pRec->is_done()); m_FlatCombining.release_record( pRec ); } @@ -318,14 +318,14 @@ namespace cds { namespace container { // this function is called under FC mutex, so switch TSan off CDS_TSAN_ANNOTATE_IGNORE_RW_BEGIN; - switch ( pRec->op() ) { + switch ( pRec->op()) { case op_enq: assert( pRec->pValEnq ); - m_Queue.push( *(pRec->pValEnq ) ); + m_Queue.push( *(pRec->pValEnq )); break; case op_enq_move: assert( pRec->pValEnq ); - m_Queue.push( std::move( *(pRec->pValEnq )) ); + m_Queue.push( std::move( *(pRec->pValEnq ))); break; case op_deq: assert( pRec->pValDeq ); @@ -336,7 +336,7 @@ namespace cds { namespace container { } break; case op_clear: - while ( !m_Queue.empty() ) + while ( !m_Queue.empty()) m_Queue.pop(); break; default: @@ -355,11 +355,11 @@ namespace cds { namespace container { CDS_TSAN_ANNOTATE_IGNORE_RW_BEGIN; for ( fc_iterator it = itBegin, itPrev = itEnd; it != itEnd; ++it ) { - switch ( it->op() ) { + switch ( it->op()) { case op_enq: case op_enq_move: case op_deq: - if ( m_Queue.empty() ) { + if ( m_Queue.empty()) { if ( itPrev != itEnd && collide( *itPrev, *it )) itPrev = itEnd; else @@ -376,7 +376,7 @@ namespace cds { namespace container { //@cond bool collide( fc_record& rec1, fc_record& rec2 ) { - switch ( rec1.op() ) { + switch ( rec1.op()) { case op_enq: if ( rec2.op() == op_deq ) { assert(rec1.pValEnq); @@ -396,7 +396,7 @@ namespace cds { namespace container { } break; case op_deq: - switch ( rec2.op() ) { + switch ( rec2.op()) { case op_enq: case op_enq_move: return collide( rec2, rec1 ); diff --git a/cds/container/fcstack.h b/cds/container/fcstack.h index 5c5e1473..87521a53 100644 --- a/cds/container/fcstack.h +++ b/cds/container/fcstack.h @@ -191,7 +191,7 @@ namespace cds { namespace container { else m_FlatCombining.combine( op_push, pRec, *this ); - assert( pRec->is_done() ); + assert( pRec->is_done()); m_FlatCombining.release_record( pRec ); m_FlatCombining.internal_statistics().onPush(); return true; @@ -211,7 +211,7 @@ namespace cds { namespace container { else m_FlatCombining.combine( op_push_move, pRec, *this ); - assert( pRec->is_done() ); + assert( pRec->is_done()); m_FlatCombining.release_record( pRec ); m_FlatCombining.internal_statistics().onPushMove(); @@ -232,7 +232,7 @@ namespace cds { namespace container { else m_FlatCombining.combine( op_pop, pRec, *this ); - assert( pRec->is_done() ); + assert( pRec->is_done()); m_FlatCombining.release_record( pRec ); m_FlatCombining.internal_statistics().onPop( pRec->bEmpty ); @@ -249,7 +249,7 @@ namespace cds { namespace container { else m_FlatCombining.combine( op_clear, pRec, *this ); - assert( pRec->is_done() ); + assert( pRec->is_done()); m_FlatCombining.release_record( pRec ); } @@ -277,7 +277,7 @@ namespace cds { namespace container { else m_FlatCombining.combine( op_empty, pRec, *this ); - assert( pRec->is_done() ); + assert( pRec->is_done()); m_FlatCombining.release_record( pRec ); return pRec->bEmpty; } @@ -303,14 +303,14 @@ namespace cds { namespace container { // this function is called under FC mutex, so switch TSan off CDS_TSAN_ANNOTATE_IGNORE_RW_BEGIN; - switch ( pRec->op() ) { + switch ( pRec->op()) { case op_push: assert( pRec->pValPush ); - m_Stack.push( *(pRec->pValPush ) ); + m_Stack.push( *(pRec->pValPush )); break; case op_push_move: assert( pRec->pValPush ); - m_Stack.push( std::move( *(pRec->pValPush )) ); + m_Stack.push( std::move( *(pRec->pValPush ))); break; case op_pop: assert( pRec->pValPop ); @@ -321,7 +321,7 @@ namespace cds { namespace container { } break; case op_clear: - while ( !m_Stack.empty() ) + while ( !m_Stack.empty()) m_Stack.pop(); break; case op_empty: @@ -342,7 +342,7 @@ namespace cds { namespace container { typedef typename fc_kernel::iterator fc_iterator; for ( fc_iterator it = itBegin, itPrev = itEnd; it != itEnd; ++it ) { - switch ( it->op() ) { + switch ( it->op()) { case op_push: case op_push_move: case op_pop: @@ -361,7 +361,7 @@ namespace cds { namespace container { //@cond bool collide( fc_record& rec1, fc_record& rec2 ) { - switch ( rec1.op() ) { + switch ( rec1.op()) { case op_push: if ( rec2.op() == op_pop ) { assert(rec1.pValPush); @@ -381,7 +381,7 @@ namespace cds { namespace container { } break; case op_pop: - switch ( rec2.op() ) { + switch ( rec2.op()) { case op_push: case op_push_move: return collide( rec2, rec1 ); diff --git a/cds/container/feldman_hashmap_rcu.h b/cds/container/feldman_hashmap_rcu.h index f356748d..8394c983 100644 --- a/cds/container/feldman_hashmap_rcu.h +++ b/cds/container/feldman_hashmap_rcu.h @@ -352,7 +352,7 @@ namespace cds { namespace container { template bool insert( K&& key ) { - scoped_node_ptr sp( cxx_node_allocator().MoveNew( m_Hasher, std::forward(key) )); + scoped_node_ptr sp( cxx_node_allocator().MoveNew( m_Hasher, std::forward(key))); if ( base_class::insert( *sp )) { sp.release(); return true; @@ -566,7 +566,7 @@ namespace cds { namespace container { template bool contains( K const& key ) { - return base_class::contains( m_Hasher( key_type( key )) ); + return base_class::contains( m_Hasher( key_type( key ))); } /// Find the key \p key diff --git a/cds/container/impl/bronson_avltree_map_rcu.h b/cds/container/impl/bronson_avltree_map_rcu.h index 29805b0b..e5dd40c0 100644 --- a/cds/container/impl/bronson_avltree_map_rcu.h +++ b/cds/container/impl/bronson_avltree_map_rcu.h @@ -231,7 +231,7 @@ namespace cds { namespace container { void clean() { - assert( !gc::is_locked() ); + assert( !gc::is_locked()); // TODO: use RCU::batch_retire @@ -675,7 +675,7 @@ namespace cds { namespace container { this sequence \code set.clear(); - assert( set.empty() ); + assert( set.empty()); \endcode the assertion could be raised. @@ -685,7 +685,7 @@ namespace cds { namespace container { */ void clear() { - while ( extract_min() ); + while ( extract_min()); } /// Clears the tree (not thread safe) @@ -962,7 +962,7 @@ namespace cds { namespace container { template find_result try_find( Q const& key, Compare cmp, Func f, node_type * pNode, int nDir, version_type nVersion ) const { - assert( gc::is_locked() ); + assert( gc::is_locked()); assert( pNode ); struct stack_record @@ -997,12 +997,12 @@ namespace cds { namespace container { int nCmp = cmp( key, pChild->m_key ); if ( nCmp == 0 ) { - if ( pChild->is_valued( memory_model::memory_order_acquire ) ) { + if ( pChild->is_valued( memory_model::memory_order_acquire )) { // key found node_scoped_lock l( m_Monitor, *pChild ); if ( child(pNode, nDir, memory_model::memory_order_acquire) == pChild ) { if ( pChild->is_valued( memory_model::memory_order_relaxed )) { - if ( f( pChild ) ) { + if ( f( pChild )) { m_stat.onFindSuccess(); return find_result::found; } @@ -1059,7 +1059,7 @@ namespace cds { namespace container { template int try_update_root( K const& key, Compare cmp, int nFlags, Func funcUpdate, rcu_disposer& disp ) { - assert( gc::is_locked() ); + assert( gc::is_locked()); while ( true ) { int result; @@ -1114,7 +1114,7 @@ namespace cds { namespace container { template bool try_remove_root( K const& key, Compare cmp, Func func, rcu_disposer& disp ) { - assert( gc::is_locked() ); + assert( gc::is_locked()); while ( true ) { int result; @@ -1149,7 +1149,7 @@ namespace cds { namespace container { template int try_update( K const& key, Compare cmp, int nFlags, Func funcUpdate, node_type * pNode, version_type nVersion, rcu_disposer& disp ) { - assert( gc::is_locked() ); + assert( gc::is_locked()); assert( nVersion != node_type::unlinked ); struct stack_record @@ -1237,7 +1237,7 @@ namespace cds { namespace container { template int try_remove( K const& key, Compare cmp, Func func, node_type * pParent, node_type * pNode, version_type nVersion, rcu_disposer& disp ) { - assert( gc::is_locked() ); + assert( gc::is_locked()); assert( nVersion != node_type::unlinked ); struct stack_record @@ -1317,7 +1317,7 @@ namespace cds { namespace container { template int try_extract_minmax( int nDir, Func func, node_type * pParent, node_type * pNode, version_type nVersion, rcu_disposer& disp ) { - assert( gc::is_locked() ); + assert( gc::is_locked()); assert( nVersion != node_type::unlinked ); struct stack_record @@ -1468,7 +1468,7 @@ namespace cds { namespace container { return update_flags::retry; } - if ( pNode->is_valued( memory_model::memory_order_relaxed ) && !(nFlags & update_flags::allow_update) ) { + if ( pNode->is_valued( memory_model::memory_order_relaxed ) && !(nFlags & update_flags::allow_update)) { m_stat.onInsertFailed(); return update_flags::failed; } @@ -1505,7 +1505,7 @@ namespace cds { namespace container { assert( pParent != nullptr ); assert( pNode != nullptr ); - if ( !pNode->is_valued( memory_model::memory_order_acquire ) ) + if ( !pNode->is_valued( memory_model::memory_order_acquire )) return update_flags::failed; if ( child( pNode, left_child, memory_model::memory_order_acquire ) == nullptr @@ -1574,7 +1574,7 @@ namespace cds { namespace container { bool try_unlink_locked( node_type * pParent, node_type * pNode, rcu_disposer& disp ) { // pParent and pNode must be locked - assert( !pParent->is_unlinked(memory_model::memory_order_relaxed) ); + assert( !pParent->is_unlinked(memory_model::memory_order_relaxed)); node_type * pParentLeft = child( pParent, left_child, memory_model::memory_order_relaxed ); node_type * pParentRight = child( pParent, right_child, memory_model::memory_order_relaxed ); @@ -1666,7 +1666,7 @@ namespace cds { namespace container { { while ( pNode && parent( pNode, memory_model::memory_order_acquire )) { int nCond = estimate_node_condition( pNode ); - if ( nCond == nothing_required || pNode->is_unlinked( memory_model::memory_order_acquire ) ) + if ( nCond == nothing_required || pNode->is_unlinked( memory_model::memory_order_acquire )) return; if ( nCond != unlink_required && nCond != rebalance_required ) @@ -1904,7 +1904,7 @@ namespace cds { namespace container { } // pLeft might also have routing node damage (if pLeft.left was null) - if ( hLL == 0 && !pLeft->is_valued(memory_model::memory_order_acquire) ) { + if ( hLL == 0 && !pLeft->is_valued(memory_model::memory_order_acquire)) { m_stat.onDamageAfterRightRotation(); return pLeft; } @@ -1956,7 +1956,7 @@ namespace cds { namespace container { return pNode; } - if ( (pRLeft == nullptr || hL == 0) && !pNode->is_valued(memory_model::memory_order_relaxed) ) { + if ( (pRLeft == nullptr || hL == 0) && !pNode->is_valued(memory_model::memory_order_relaxed)) { m_stat.onRemoveAfterLeftRotation(); return pNode; } @@ -1967,7 +1967,7 @@ namespace cds { namespace container { return pRight; } - if ( hRR == 0 && !pRight->is_valued(memory_model::memory_order_acquire) ) { + if ( hRR == 0 && !pRight->is_valued(memory_model::memory_order_acquire)) { m_stat.onDamageAfterLeftRotation(); return pRight; } @@ -2114,7 +2114,7 @@ namespace cds { namespace container { return pNode; } - if ( (pRLL == nullptr || hL == 0) && !pNode->is_valued(memory_model::memory_order_relaxed) ) { + if ( (pRLL == nullptr || hL == 0) && !pNode->is_valued(memory_model::memory_order_relaxed)) { m_stat.onRemoveAfterLRRotation(); return pNode; } diff --git a/cds/container/impl/ellen_bintree_map.h b/cds/container/impl/ellen_bintree_map.h index 7e1cb48d..1949c7fb 100644 --- a/cds/container/impl/ellen_bintree_map.h +++ b/cds/container/impl/ellen_bintree_map.h @@ -489,7 +489,7 @@ namespace cds { namespace container { bool contains( K const& key, Less pred ) { CDS_UNUSED( pred ); - return base_class::contains( key, cds::details::predicate_wrapper< leaf_node, Less, typename maker::key_accessor >() ); + return base_class::contains( key, cds::details::predicate_wrapper< leaf_node, Less, typename maker::key_accessor >()); } //@cond template @@ -527,7 +527,7 @@ namespace cds { namespace container { { CDS_UNUSED( pred ); return guarded_ptr( base_class::get_with_( key, - cds::details::predicate_wrapper< leaf_node, Less, typename maker::key_accessor >() )); + cds::details::predicate_wrapper< leaf_node, Less, typename maker::key_accessor >())); } /// Clears the map (not atomic) diff --git a/cds/container/impl/ellen_bintree_set.h b/cds/container/impl/ellen_bintree_set.h index b3e8a43a..282c7261 100644 --- a/cds/container/impl/ellen_bintree_set.h +++ b/cds/container/impl/ellen_bintree_set.h @@ -201,7 +201,7 @@ namespace cds { namespace container { bool insert( Q const& val ) { scoped_node_ptr sp( cxx_leaf_node_allocator().New( val )); - if ( base_class::insert( *sp.get() )) { + if ( base_class::insert( *sp.get())) { sp.release(); return true; } @@ -291,7 +291,7 @@ namespace cds { namespace container { bool emplace( Args&&... args ) { scoped_node_ptr sp( cxx_leaf_node_allocator().MoveNew( std::forward(args)... )); - if ( base_class::insert( *sp.get() )) { + if ( base_class::insert( *sp.get())) { sp.release(); return true; } @@ -566,7 +566,7 @@ namespace cds { namespace container { { CDS_UNUSED(pred); return base_class::get_with_( key, - cds::details::predicate_wrapper< leaf_node, Less, typename maker::value_accessor >() ); + cds::details::predicate_wrapper< leaf_node, Less, typename maker::value_accessor >()); } /// Clears the set (not atomic) @@ -576,7 +576,7 @@ namespace cds { namespace container { this sequence \code set.clear(); - assert( set.empty() ); + assert( set.empty()); \endcode the assertion could be raised. diff --git a/cds/container/impl/feldman_hashmap.h b/cds/container/impl/feldman_hashmap.h index 9046679f..c3934923 100644 --- a/cds/container/impl/feldman_hashmap.h +++ b/cds/container/impl/feldman_hashmap.h @@ -384,7 +384,7 @@ namespace cds { namespace container { template bool insert( K&& key ) { - scoped_node_ptr sp( cxx_node_allocator().MoveNew( m_Hasher, std::forward( key ) )); + scoped_node_ptr sp( cxx_node_allocator().MoveNew( m_Hasher, std::forward( key ))); if ( base_class::insert( *sp )) { sp.release(); return true; @@ -603,7 +603,7 @@ namespace cds { namespace container { template bool contains( K const& key ) { - return base_class::contains( m_Hasher( key_type( key )) ); + return base_class::contains( m_Hasher( key_type( key ))); } /// Find the key \p key diff --git a/cds/container/impl/iterable_kvlist.h b/cds/container/impl/iterable_kvlist.h index f684a757..3595b9ec 100644 --- a/cds/container/impl/iterable_kvlist.h +++ b/cds/container/impl/iterable_kvlist.h @@ -217,7 +217,7 @@ namespace cds { namespace container { this code \code if ( it1 == it2 ) - assert( &(*it1) == &(*it2) ); + assert( &(*it1) == &(*it2)); \endcode can throw assertion. The point is that the iterator stores the value of element which can be modified later by other thread. The guard inside the iterator prevents recycling that value so the iterator's value remains valid even after such changing. @@ -409,7 +409,7 @@ namespace cds { namespace container { bool erase_with( K const& key, Less pred ) { CDS_UNUSED( pred ); - return base_class::erase_with( key, less_wrapper() ); + return base_class::erase_with( key, less_wrapper()); } /// Deletes \p key from the list @@ -491,7 +491,7 @@ namespace cds { namespace container { guarded_ptr extract_with( K const& key, Less pred ) { CDS_UNUSED( pred ); - return base_class::extract_with( key, less_wrapper() ); + return base_class::extract_with( key, less_wrapper()); } /// Checks whether the list contains \p key @@ -515,7 +515,7 @@ namespace cds { namespace container { bool contains( Q const& key, Less pred ) const { CDS_UNUSED( pred ); - return base_class::contains( key, less_wrapper() ); + return base_class::contains( key, less_wrapper()); } /// Finds the key \p key and performs an action with it @@ -625,7 +625,7 @@ namespace cds { namespace container { guarded_ptr get_with( K const& key, Less pred ) const { CDS_UNUSED( pred ); - return base_class::get_with( key, less_wrapper() ); + return base_class::get_with( key, less_wrapper()); } /// Checks if the list is empty @@ -668,7 +668,7 @@ namespace cds { namespace container { template bool insert_at( head_type& refHead, K&& key ) { - return base_class::insert_at( refHead, value_type( key_type( std::forward( key )), mapped_type() )); + return base_class::insert_at( refHead, value_type( key_type( std::forward( key )), mapped_type())); } template diff --git a/cds/container/impl/iterable_list.h b/cds/container/impl/iterable_list.h index c4922921..b8dbe688 100644 --- a/cds/container/impl/iterable_list.h +++ b/cds/container/impl/iterable_list.h @@ -265,7 +265,7 @@ namespace cds { namespace container { this code \code if ( it1 == it2 ) - assert( &(*it1) == &(*it2) ); + assert( &(*it1) == &(*it2)); \endcode can throw assertion. The point is that the iterator stores the value of element which can be modified later by other thread. The guard inside the iterator prevents recycling that value so the iterator's value remains valid even after such changing. @@ -285,7 +285,7 @@ namespace cds { namespace container { */ iterator begin() { - return iterator( base_class::begin() ); + return iterator( base_class::begin()); } /// Returns an iterator that addresses the location succeeding the last element in a list @@ -304,13 +304,13 @@ namespace cds { namespace container { /// Returns a forward const iterator addressing the first element in a list const_iterator begin() const { - return const_iterator( base_class::cbegin() ); + return const_iterator( base_class::cbegin()); } /// Returns a forward const iterator addressing the first element in a list const_iterator cbegin() const { - return const_iterator( base_class::cbegin() ); + return const_iterator( base_class::cbegin()); } /// Returns an const iterator that addresses the location succeeding the last element in a list @@ -552,7 +552,7 @@ namespace cds { namespace container { template guarded_ptr extract( Q const& key ) { - return extract_at( head(), key, key_comparator() ); + return extract_at( head(), key, key_comparator()); } /// Extracts the item from the list with comparing functor \p pred @@ -567,7 +567,7 @@ namespace cds { namespace container { guarded_ptr extract_with( Q const& key, Less pred ) { CDS_UNUSED( pred ); - return extract_at( head(), key, typename maker::template less_wrapper::type() ); + return extract_at( head(), key, typename maker::template less_wrapper::type()); } /// Checks whether the list contains \p key @@ -578,7 +578,7 @@ namespace cds { namespace container { template bool contains( Q const& key ) const { - return find_at( head(), key, key_comparator() ); + return find_at( head(), key, key_comparator()); } /// Checks whether the list contains \p key using \p pred predicate for searching @@ -591,7 +591,7 @@ namespace cds { namespace container { bool contains( Q const& key, Less pred ) const { CDS_UNUSED( pred ); - return find_at( head(), key, typename maker::template less_wrapper::type() ); + return find_at( head(), key, typename maker::template less_wrapper::type()); } /// Finds \p key and perform an action with it @@ -700,7 +700,7 @@ namespace cds { namespace container { template guarded_ptr get( Q const& key ) const { - return get_at( head(), key, key_comparator() ); + return get_at( head(), key, key_comparator()); } /// Finds \p key and return the item found @@ -716,7 +716,7 @@ namespace cds { namespace container { guarded_ptr get_with( Q const& key, Less pred ) const { CDS_UNUSED( pred ); - return get_at( head(), key, typename maker::template less_wrapper::type() ); + return get_at( head(), key, typename maker::template less_wrapper::type()); } /// Checks if the list is empty diff --git a/cds/container/impl/lazy_kvlist.h b/cds/container/impl/lazy_kvlist.h index 218bc87c..08726861 100644 --- a/cds/container/impl/lazy_kvlist.h +++ b/cds/container/impl/lazy_kvlist.h @@ -231,10 +231,10 @@ namespace cds { namespace container { typedef typename base_class::template iterator_type iterator_base; iterator_type( head_type const& pNode ) - : iterator_base( const_cast(&pNode) ) + : iterator_base( const_cast(&pNode)) {} iterator_type( head_type const * pNode ) - : iterator_base( const_cast(pNode) ) + : iterator_base( const_cast(pNode)) {} friend class LazyKVList; @@ -337,7 +337,7 @@ namespace cds { namespace container { */ iterator begin() { - iterator it( head() ); + iterator it( head()); ++it ; // skip dummy head return it; } @@ -352,13 +352,13 @@ namespace cds { namespace container { */ iterator end() { - return iterator( tail() ); + return iterator( tail()); } /// Returns a forward const iterator addressing the first element in a list const_iterator begin() const { - const_iterator it( head() ); + const_iterator it( head()); ++it; // skip dummy head return it; } @@ -366,7 +366,7 @@ namespace cds { namespace container { /// Returns a forward const iterator addressing the first element in a list const_iterator cbegin() const { - const_iterator it( head() ); + const_iterator it( head()); ++it; // skip dummy head return it; } @@ -527,7 +527,7 @@ namespace cds { namespace container { template bool erase( K const& key ) { - return erase_at( head(), key, intrusive_key_comparator() ); + return erase_at( head(), key, intrusive_key_comparator()); } /// Deletes the item from the list using \p pred predicate for searching @@ -541,7 +541,7 @@ namespace cds { namespace container { bool erase_with( K const& key, Less pred ) { CDS_UNUSED( pred ); - return erase_at( head(), key, typename maker::template less_wrapper::type() ); + return erase_at( head(), key, typename maker::template less_wrapper::type()); } /// Deletes \p key from the list @@ -606,7 +606,7 @@ namespace cds { namespace container { template guarded_ptr extract( K const& key ) { - return extract_at( head(), key, intrusive_key_comparator() ); + return extract_at( head(), key, intrusive_key_comparator()); } /// Extracts the item from the list with comparing functor \p pred @@ -622,7 +622,7 @@ namespace cds { namespace container { guarded_ptr extract_with( K const& key, Less pred ) { CDS_UNUSED( pred ); - return extract_at( head(), key, typename maker::template less_wrapper::type() ); + return extract_at( head(), key, typename maker::template less_wrapper::type()); } /// Checks whether the list contains \p key @@ -633,7 +633,7 @@ namespace cds { namespace container { template bool contains( Q const& key ) { - return find_at( head(), key, intrusive_key_comparator() ); + return find_at( head(), key, intrusive_key_comparator()); } //@cond template @@ -654,7 +654,7 @@ namespace cds { namespace container { bool contains( Q const& key, Less pred ) { CDS_UNUSED( pred ); - return find_at( head(), key, typename maker::template less_wrapper::type() ); + return find_at( head(), key, typename maker::template less_wrapper::type()); } //@cond template @@ -732,7 +732,7 @@ namespace cds { namespace container { template guarded_ptr get( K const& key ) { - return get_at( head(), key, intrusive_key_comparator() ); + return get_at( head(), key, intrusive_key_comparator()); } /// Finds the key \p val and return the item found @@ -748,7 +748,7 @@ namespace cds { namespace container { guarded_ptr get_with( K const& key, Less pred ) { CDS_UNUSED( pred ); - return get_at( head(), key, typename maker::template less_wrapper::type() ); + return get_at( head(), key, typename maker::template less_wrapper::type()); } /// Checks if the list is empty diff --git a/cds/container/impl/lazy_list.h b/cds/container/impl/lazy_list.h index dfe95d08..726d564a 100644 --- a/cds/container/impl/lazy_list.h +++ b/cds/container/impl/lazy_list.h @@ -273,7 +273,7 @@ namespace cds { namespace container { */ iterator begin() { - iterator it( head() ); + iterator it( head()); ++it ; // skip dummy head node return it; } @@ -287,13 +287,13 @@ namespace cds { namespace container { */ iterator end() { - return iterator( tail() ); + return iterator( tail()); } /// Returns a forward const iterator addressing the first element in a list const_iterator begin() const { - const_iterator it( head() ); + const_iterator it( head()); ++it ; // skip dummy head node return it; } @@ -301,7 +301,7 @@ namespace cds { namespace container { /// Returns a forward const iterator addressing the first element in a list const_iterator cbegin() const { - const_iterator it( head() ); + const_iterator it( head()); ++it ; // skip dummy head node return it; } @@ -309,13 +309,13 @@ namespace cds { namespace container { /// Returns an const iterator that addresses the location succeeding the last element in a list const_iterator end() const { - return const_iterator( tail() ); + return const_iterator( tail()); } /// Returns an const iterator that addresses the location succeeding the last element in a list const_iterator cend() const { - return const_iterator( tail() ); + return const_iterator( tail()); } //@} @@ -532,7 +532,7 @@ namespace cds { namespace container { template guarded_ptr extract( Q const& key ) { - return extract_at( head(), key, intrusive_key_comparator() ); + return extract_at( head(), key, intrusive_key_comparator()); } /// Extracts the item from the list with comparing functor \p pred @@ -548,7 +548,7 @@ namespace cds { namespace container { guarded_ptr extract_with( Q const& key, Less pred ) { CDS_UNUSED( pred ); - return extract_at( head(), key, typename maker::template less_wrapper::type() ); + return extract_at( head(), key, typename maker::template less_wrapper::type()); } /// Checks whether the list contains \p key @@ -559,7 +559,7 @@ namespace cds { namespace container { template bool contains( Q const& key ) { - return find_at( head(), key, intrusive_key_comparator() ); + return find_at( head(), key, intrusive_key_comparator()); } //@cond template @@ -580,7 +580,7 @@ namespace cds { namespace container { bool contains( Q const& key, Less pred ) { CDS_UNUSED( pred ); - return find_at( head(), key, typename maker::template less_wrapper::type() ); + return find_at( head(), key, typename maker::template less_wrapper::type()); } //@cond template @@ -675,7 +675,7 @@ namespace cds { namespace container { template guarded_ptr get( Q const& key ) { - return get_at( head(), key, intrusive_key_comparator() ); + return get_at( head(), key, intrusive_key_comparator()); } /// Finds the key \p key and return the item found @@ -691,7 +691,7 @@ namespace cds { namespace container { guarded_ptr get_with( Q const& key, Less pred ) { CDS_UNUSED( pred ); - return get_at( head(), key, typename maker::template less_wrapper::type() ); + return get_at( head(), key, typename maker::template less_wrapper::type()); } /// Checks whether the list is empty @@ -809,7 +809,7 @@ namespace cds { namespace container { { scoped_node_ptr pNode( alloc_node( std::forward( key ))); - if ( base_class::insert_at( &refHead, *pNode, [&f](node_type& node){ f( node_to_value(node) ); } )) { + if ( base_class::insert_at( &refHead, *pNode, [&f](node_type& node){ f( node_to_value(node)); } )) { pNode.release(); return true; } @@ -819,7 +819,7 @@ namespace cds { namespace container { template bool erase_at( head_type& refHead, Q const& key, Compare cmp, Func f ) { - return base_class::erase_at( &refHead, key, cmp, [&f](node_type const& node){ f( node_to_value(node) ); } ); + return base_class::erase_at( &refHead, key, cmp, [&f](node_type const& node){ f( node_to_value(node)); } ); } template diff --git a/cds/container/impl/michael_kvlist.h b/cds/container/impl/michael_kvlist.h index 72602e10..2d22b8e1 100644 --- a/cds/container/impl/michael_kvlist.h +++ b/cds/container/impl/michael_kvlist.h @@ -326,7 +326,7 @@ namespace cds { namespace container { */ iterator begin() { - return iterator( head() ); + return iterator( head()); } /// Returns an iterator that addresses the location succeeding the last element in a list @@ -345,13 +345,13 @@ namespace cds { namespace container { /// Returns a forward const iterator addressing the first element in a list const_iterator begin() const { - return const_iterator( head() ); + return const_iterator( head()); } /// Returns a forward const iterator addressing the first element in a list const_iterator cbegin() const { - return const_iterator( head() ); + return const_iterator( head()); } /// Returns an const iterator that addresses the location succeeding the last element in a list @@ -525,7 +525,7 @@ namespace cds { namespace container { template bool erase( K const& key ) { - return erase_at( head(), key, intrusive_key_comparator() ); + return erase_at( head(), key, intrusive_key_comparator()); } /// Deletes the item from the list using \p pred predicate for searching @@ -539,7 +539,7 @@ namespace cds { namespace container { bool erase_with( K const& key, Less pred ) { CDS_UNUSED( pred ); - return erase_at( head(), key, typename maker::template less_wrapper::type() ); + return erase_at( head(), key, typename maker::template less_wrapper::type()); } /// Deletes \p key from the list @@ -609,7 +609,7 @@ namespace cds { namespace container { template guarded_ptr extract( K const& key ) { - return extract_at( head(), key, intrusive_key_comparator() ); + return extract_at( head(), key, intrusive_key_comparator()); } /// Extracts the item from the list with comparing functor \p pred @@ -625,7 +625,7 @@ namespace cds { namespace container { guarded_ptr extract_with( K const& key, Less pred ) { CDS_UNUSED( pred ); - return extract_at( head(), key, typename maker::template less_wrapper::type() ); + return extract_at( head(), key, typename maker::template less_wrapper::type()); } /// Checks whether the list contains \p key @@ -636,7 +636,7 @@ namespace cds { namespace container { template bool contains( Q const& key ) { - return find_at( head(), key, intrusive_key_comparator() ); + return find_at( head(), key, intrusive_key_comparator()); } //@cond template @@ -657,7 +657,7 @@ namespace cds { namespace container { bool contains( Q const& key, Less pred ) { CDS_UNUSED( pred ); - return find_at( head(), key, typename maker::template less_wrapper::type() ); + return find_at( head(), key, typename maker::template less_wrapper::type()); } //@cond template @@ -736,7 +736,7 @@ namespace cds { namespace container { template guarded_ptr get( K const& key ) { - return get_at( head(), key, intrusive_key_comparator() ); + return get_at( head(), key, intrusive_key_comparator()); } /// Finds the \p key and return the item found @@ -752,7 +752,7 @@ namespace cds { namespace container { guarded_ptr get_with( K const& key, Less pred ) { CDS_UNUSED( pred ); - return get_at( head(), key, typename maker::template less_wrapper::type() ); + return get_at( head(), key, typename maker::template less_wrapper::type()); } /// Checks if the list is empty diff --git a/cds/container/impl/michael_list.h b/cds/container/impl/michael_list.h index 048dba0f..fdf9351d 100644 --- a/cds/container/impl/michael_list.h +++ b/cds/container/impl/michael_list.h @@ -264,7 +264,7 @@ namespace cds { namespace container { */ iterator begin() { - return iterator( head() ); + return iterator( head()); } /// Returns an iterator that addresses the location succeeding the last element in a list @@ -283,13 +283,13 @@ namespace cds { namespace container { /// Returns a forward const iterator addressing the first element in a list const_iterator begin() const { - return const_iterator( head() ); + return const_iterator( head()); } /// Returns a forward const iterator addressing the first element in a list const_iterator cbegin() const { - return const_iterator( head() ); + return const_iterator( head()); } /// Returns an const iterator that addresses the location succeeding the last element in a list @@ -525,7 +525,7 @@ namespace cds { namespace container { template guarded_ptr extract( Q const& key ) { - return extract_at( head(), key, intrusive_key_comparator() ); + return extract_at( head(), key, intrusive_key_comparator()); } /// Extracts the item from the list with comparing functor \p pred @@ -541,7 +541,7 @@ namespace cds { namespace container { guarded_ptr extract_with( Q const& key, Less pred ) { CDS_UNUSED( pred ); - return extract_at( head(), key, typename maker::template less_wrapper::type() ); + return extract_at( head(), key, typename maker::template less_wrapper::type()); } /// Checks whether the list contains \p key @@ -552,7 +552,7 @@ namespace cds { namespace container { template bool contains( Q const& key ) { - return find_at( head(), key, intrusive_key_comparator() ); + return find_at( head(), key, intrusive_key_comparator()); } //@cond template @@ -573,7 +573,7 @@ namespace cds { namespace container { bool contains( Q const& key, Less pred ) { CDS_UNUSED( pred ); - return find_at( head(), key, typename maker::template less_wrapper::type() ); + return find_at( head(), key, typename maker::template less_wrapper::type()); } //@cond template @@ -666,7 +666,7 @@ namespace cds { namespace container { template guarded_ptr get( Q const& key ) { - return get_at( head(), key, intrusive_key_comparator() ); + return get_at( head(), key, intrusive_key_comparator()); } /// Finds \p key and return the item found @@ -682,7 +682,7 @@ namespace cds { namespace container { guarded_ptr get_with( Q const& key, Less pred ) { CDS_UNUSED( pred ); - return get_at( head(), key, typename maker::template less_wrapper::type() ); + return get_at( head(), key, typename maker::template less_wrapper::type()); } /// Check if the list is empty @@ -782,7 +782,7 @@ namespace cds { namespace container { { scoped_node_ptr pNode( alloc_node( std::forward( key ))); - if ( base_class::insert_at( refHead, *pNode, [&f]( node_type& node ) { f( node_to_value(node) ); } )) { + if ( base_class::insert_at( refHead, *pNode, [&f]( node_type& node ) { f( node_to_value(node)); } )) { pNode.release(); return true; } @@ -798,7 +798,7 @@ namespace cds { namespace container { template bool erase_at( head_type& refHead, Q const& key, Compare cmp, Func f ) { - return base_class::erase_at( refHead, key, cmp, [&f](node_type const& node){ f( node_to_value(node) ); } ); + return base_class::erase_at( refHead, key, cmp, [&f](node_type const& node){ f( node_to_value(node)); } ); } template diff --git a/cds/container/impl/skip_list_map.h b/cds/container/impl/skip_list_map.h index 868a82d2..021dd8e7 100644 --- a/cds/container/impl/skip_list_map.h +++ b/cds/container/impl/skip_list_map.h @@ -208,7 +208,7 @@ namespace cds { namespace container { /// Returns a forward iterator addressing the first element in a map iterator begin() { - return iterator( base_class::begin() ); + return iterator( base_class::begin()); } /// Returns a forward const iterator addressing the first element in a map @@ -220,13 +220,13 @@ namespace cds { namespace container { /// Returns a forward const iterator addressing the first element in a map const_iterator cbegin() const { - return const_iterator( base_class::cbegin() ); + return const_iterator( base_class::cbegin()); } /// Returns a forward iterator that addresses the location succeeding the last element in a map. iterator end() { - return iterator( base_class::end() ); + return iterator( base_class::end()); } /// Returns a forward const iterator that addresses the location succeeding the last element in a map. @@ -238,7 +238,7 @@ namespace cds { namespace container { /// Returns a forward const iterator that addresses the location succeeding the last element in a map. const_iterator cend() const { - return const_iterator( base_class::cend() ); + return const_iterator( base_class::cend()); } //@} @@ -466,7 +466,7 @@ namespace cds { namespace container { template guarded_ptr extract( K const& key ) { - return base_class::extract_( key, typename base_class::key_comparator() ); + return base_class::extract_( key, typename base_class::key_comparator()); } /// Extracts the item from the map with comparing functor \p pred @@ -483,7 +483,7 @@ namespace cds { namespace container { { CDS_UNUSED( pred ); typedef cds::details::predicate_wrapper< node_type, Less, typename maker::key_accessor > wrapped_less; - return base_class::extract_( key, cds::opt::details::make_comparator_from_less() ); + return base_class::extract_( key, cds::opt::details::make_comparator_from_less()); } /// Extracts an item with minimal key from the map @@ -611,7 +611,7 @@ namespace cds { namespace container { bool contains( K const& key, Less pred ) { CDS_UNUSED( pred ); - return base_class::contains( key, cds::details::predicate_wrapper< node_type, Less, typename maker::key_accessor >() ); + return base_class::contains( key, cds::details::predicate_wrapper< node_type, Less, typename maker::key_accessor >()); } //@cond template @@ -654,7 +654,7 @@ namespace cds { namespace container { template guarded_ptr get( K const& key ) { - return base_class::get_with_( key, typename base_class::key_comparator() ); + return base_class::get_with_( key, typename base_class::key_comparator()); } /// Finds the key \p key and return the item found diff --git a/cds/container/impl/skip_list_set.h b/cds/container/impl/skip_list_set.h index 4389cce0..18fa1182 100644 --- a/cds/container/impl/skip_list_set.h +++ b/cds/container/impl/skip_list_set.h @@ -237,37 +237,37 @@ namespace cds { namespace container { /// Returns a forward iterator addressing the first element in a set iterator begin() { - return iterator( base_class::begin() ); + return iterator( base_class::begin()); } /// Returns a forward const iterator addressing the first element in a set const_iterator begin() const { - return const_iterator( base_class::begin() ); + return const_iterator( base_class::begin()); } /// Returns a forward const iterator addressing the first element in a set const_iterator cbegin() const { - return const_iterator( base_class::cbegin() ); + return const_iterator( base_class::cbegin()); } /// Returns a forward iterator that addresses the location succeeding the last element in a set. iterator end() { - return iterator( base_class::end() ); + return iterator( base_class::end()); } /// Returns a forward const iterator that addresses the location succeeding the last element in a set. const_iterator end() const { - return const_iterator( base_class::end() ); + return const_iterator( base_class::end()); } /// Returns a forward const iterator that addresses the location succeeding the last element in a set. const_iterator cend() const { - return const_iterator( base_class::cend() ); + return const_iterator( base_class::cend()); } //@} @@ -287,7 +287,7 @@ namespace cds { namespace container { bool insert( Q const& val ) { scoped_node_ptr sp( node_allocator().New( random_level(), val )); - if ( base_class::insert( *sp.get() )) { + if ( base_class::insert( *sp.get())) { sp.release(); return true; } @@ -377,7 +377,7 @@ namespace cds { namespace container { bool emplace( Args&&... args ) { scoped_node_ptr sp( node_allocator().New( random_level(), std::forward(args)... )); - if ( base_class::insert( *sp.get() )) { + if ( base_class::insert( *sp.get())) { sp.release(); return true; } @@ -409,7 +409,7 @@ namespace cds { namespace container { bool erase_with( Q const& key, Less pred ) { CDS_UNUSED( pred ); - return base_class::erase_with( key, cds::details::predicate_wrapper< node_type, Less, typename maker::value_accessor >() ); + return base_class::erase_with( key, cds::details::predicate_wrapper< node_type, Less, typename maker::value_accessor >()); } /// Delete \p key from the set @@ -483,7 +483,7 @@ namespace cds { namespace container { template guarded_ptr extract( Q const& key ) { - return base_class::extract_( key, typename base_class::key_comparator() ); + return base_class::extract_( key, typename base_class::key_comparator()); } /// Extracts the item from the set with comparing functor \p pred @@ -500,7 +500,7 @@ namespace cds { namespace container { { CDS_UNUSED( pred ); typedef cds::details::predicate_wrapper< node_type, Less, typename maker::value_accessor > wrapped_less; - return base_class::extract_( key, cds::opt::details::make_comparator_from_less() ); + return base_class::extract_( key, cds::opt::details::make_comparator_from_less()); } /// Extracts an item with minimal key from the set @@ -692,7 +692,7 @@ namespace cds { namespace container { template guarded_ptr get( Q const& key ) { - return base_class::get_with_( key, typename base_class::key_comparator() ); + return base_class::get_with_( key, typename base_class::key_comparator()); } /// Finds \p key and return the item found @@ -719,7 +719,7 @@ namespace cds { namespace container { this sequence \code set.clear(); - assert( set.empty() ); + assert( set.empty()); \endcode the assertion could be raised. diff --git a/cds/container/lazy_kvlist_nogc.h b/cds/container/lazy_kvlist_nogc.h index 2e419f9c..e123b8d8 100644 --- a/cds/container/lazy_kvlist_nogc.h +++ b/cds/container/lazy_kvlist_nogc.h @@ -287,7 +287,7 @@ namespace cds { namespace container { */ iterator begin() { - iterator it( head() ); + iterator it( head()); ++it ; // skip dummy head return it; } @@ -308,14 +308,14 @@ namespace cds { namespace container { /// Returns a forward const iterator addressing the first element in a list const_iterator begin() const { - const_iterator it( head() ); + const_iterator it( head()); ++it ; // skip dummy head return it; } /// Returns a forward const iterator addressing the first element in a list const_iterator cbegin() const { - const_iterator it( head() ); + const_iterator it( head()); ++it ; // skip dummy head return it; } @@ -475,7 +475,7 @@ namespace cds { namespace container { template iterator contains( Q const& key ) { - return node_to_iterator( find_at( head(), key, intrusive_key_comparator() ) ); + return node_to_iterator( find_at( head(), key, intrusive_key_comparator()) ); } //@cond template @@ -496,7 +496,7 @@ namespace cds { namespace container { typename std::enable_if::type contains( Q const& key, Less pred ) { CDS_UNUSED( pred ); - return node_to_iterator( find_at( head(), key, typename maker::template less_wrapper::type() ) ); + return node_to_iterator( find_at( head(), key, typename maker::template less_wrapper::type()) ); } //@cond template @@ -516,7 +516,7 @@ namespace cds { namespace container { typename std::enable_if::type contains( Q const& key, Equal equal ) { CDS_UNUSED( equal ); - return node_to_iterator( find_at( head(), key, typename maker::template equal_to_wrapper::type() ) ); + return node_to_iterator( find_at( head(), key, typename maker::template equal_to_wrapper::type()) ); } //@cond template diff --git a/cds/container/lazy_kvlist_rcu.h b/cds/container/lazy_kvlist_rcu.h index 37c88fcb..e3cd14f2 100644 --- a/cds/container/lazy_kvlist_rcu.h +++ b/cds/container/lazy_kvlist_rcu.h @@ -236,10 +236,10 @@ namespace cds { namespace container { typedef typename base_class::template iterator_type iterator_base; iterator_type( head_type const& pNode ) - : iterator_base( const_cast(&pNode) ) + : iterator_base( const_cast(&pNode)) {} iterator_type( head_type const * pNode ) - : iterator_base( const_cast(pNode) ) + : iterator_base( const_cast(pNode)) {} friend class LazyKVList; @@ -323,7 +323,7 @@ namespace cds { namespace container { */ iterator begin() { - iterator it( head() ); + iterator it( head()); ++it ; // skip dummy head return it; } @@ -338,13 +338,13 @@ namespace cds { namespace container { */ iterator end() { - return iterator( tail() ); + return iterator( tail()); } /// Returns a forward const iterator addressing the first element in a list const_iterator begin() const { - const_iterator it( head() ); + const_iterator it( head()); ++it; // skip dummy head return it; } @@ -352,7 +352,7 @@ namespace cds { namespace container { /// Returns a forward const iterator addressing the first element in a list const_iterator cbegin() const { - const_iterator it( head() ); + const_iterator it( head()); ++it; // skip dummy head return it; } @@ -524,7 +524,7 @@ namespace cds { namespace container { template bool erase( K const& key ) { - return erase_at( head(), key, intrusive_key_comparator() ); + return erase_at( head(), key, intrusive_key_comparator()); } /// Deletes the item from the list using \p pred predicate for searching @@ -538,7 +538,7 @@ namespace cds { namespace container { bool erase_with( K const& key, Less pred ) { CDS_UNUSED( pred ); - return erase_at( head(), key, typename maker::template less_wrapper::type() ); + return erase_at( head(), key, typename maker::template less_wrapper::type()); } /// Deletes \p key from the list @@ -634,7 +634,7 @@ namespace cds { namespace container { exempt_ptr extract_with( K const& key, Less pred ) { CDS_UNUSED( pred ); - return exempt_ptr( extract_at( head(), key, typename maker::template less_wrapper::type() )); + return exempt_ptr( extract_at( head(), key, typename maker::template less_wrapper::type())); } /// Checks whether the list contains \p key @@ -647,7 +647,7 @@ namespace cds { namespace container { template bool contains( Q const& key ) const { - return find_at( head(), key, intrusive_key_comparator() ); + return find_at( head(), key, intrusive_key_comparator()); } //@cond template @@ -670,7 +670,7 @@ namespace cds { namespace container { bool contains( Q const& key, Less pred ) const { CDS_UNUSED( pred ); - return find_at( head(), key, typename maker::template less_wrapper::type() ); + return find_at( head(), key, typename maker::template less_wrapper::type()); } //@cond template diff --git a/cds/container/lazy_list_nogc.h b/cds/container/lazy_list_nogc.h index 08947749..551b53d4 100644 --- a/cds/container/lazy_list_nogc.h +++ b/cds/container/lazy_list_nogc.h @@ -128,7 +128,7 @@ namespace cds { namespace container { typedef typename base_class::template iterator_type iterator_base; iterator_type( head_type const& pNode ) - : iterator_base( const_cast(&pNode) ) + : iterator_base( const_cast(&pNode)) {} explicit iterator_type( const iterator_base& it ) @@ -211,7 +211,7 @@ namespace cds { namespace container { */ iterator begin() { - iterator it( head() ); + iterator it( head()); ++it ; // skip dummy head node return it; } @@ -231,7 +231,7 @@ namespace cds { namespace container { /// Returns a forward const iterator addressing the first element in a list const_iterator begin() const { - const_iterator it( head() ); + const_iterator it( head()); ++it ; // skip dummy head node return it; } @@ -239,7 +239,7 @@ namespace cds { namespace container { /// Returns a forward const iterator addressing the first element in a list const_iterator cbegin() const { - const_iterator it( head() ); + const_iterator it( head()); ++it ; // skip dummy head node return it; } @@ -285,7 +285,7 @@ namespace cds { namespace container { template iterator insert( Q&& val ) { - return node_to_iterator( insert_at( head(), std::forward( val )) ); + return node_to_iterator( insert_at( head(), std::forward( val ))); } /// Inserts data of type \p value_type created from \p args @@ -332,7 +332,7 @@ namespace cds { namespace container { template iterator contains( Q const& key ) { - return node_to_iterator( find_at( head(), key, intrusive_key_comparator() )); + return node_to_iterator( find_at( head(), key, intrusive_key_comparator())); } //@cond template @@ -353,7 +353,7 @@ namespace cds { namespace container { typename std::enable_if::type contains( Q const& key, Less pred ) { CDS_UNUSED( pred ); - return node_to_iterator( find_at( head(), key, typename maker::template less_wrapper::type() )); + return node_to_iterator( find_at( head(), key, typename maker::template less_wrapper::type())); } //@cond template @@ -373,7 +373,7 @@ namespace cds { namespace container { typename std::enable_if::type contains( Q const& key, Equal equal ) { CDS_UNUSED( equal ); - return node_to_iterator( find_at( head(), key, typename maker::template equal_to_wrapper::type() )); + return node_to_iterator( find_at( head(), key, typename maker::template equal_to_wrapper::type())); } //@cond template diff --git a/cds/container/lazy_list_rcu.h b/cds/container/lazy_list_rcu.h index fa7e6eac..fea8043c 100644 --- a/cds/container/lazy_list_rcu.h +++ b/cds/container/lazy_list_rcu.h @@ -267,7 +267,7 @@ namespace cds { namespace container { */ iterator begin() { - iterator it( head() ); + iterator it( head()); ++it ; // skip dummy head node return it; } @@ -281,13 +281,13 @@ namespace cds { namespace container { */ iterator end() { - return iterator( tail() ); + return iterator( tail()); } /// Returns a forward const iterator addressing the first element in a list const_iterator begin() const { - const_iterator it( head() ); + const_iterator it( head()); ++it ; // skip dummy head node return it; } @@ -295,7 +295,7 @@ namespace cds { namespace container { /// Returns a forward const iterator addressing the first element in a list const_iterator cbegin() const { - const_iterator it( head() ); + const_iterator it( head()); ++it ; // skip dummy head node return it; } @@ -303,13 +303,13 @@ namespace cds { namespace container { /// Returns an const iterator that addresses the location succeeding the last element in a list const_iterator end() const { - return const_iterator( tail() ); + return const_iterator( tail()); } /// Returns an const iterator that addresses the location succeeding the last element in a list const_iterator cend() const { - return const_iterator( tail() ); + return const_iterator( tail()); } //@} @@ -578,7 +578,7 @@ namespace cds { namespace container { template bool contains( Q const& key ) const { - return find_at( head(), key, intrusive_key_comparator() ); + return find_at( head(), key, intrusive_key_comparator()); } //@cond template @@ -599,7 +599,7 @@ namespace cds { namespace container { bool contains( Q const& key, Less pred ) const { CDS_UNUSED( pred ); - return find_at( head(), key, typename maker::template less_wrapper::type() ); + return find_at( head(), key, typename maker::template less_wrapper::type()); } //@cond template @@ -785,7 +785,7 @@ namespace cds { namespace container { { scoped_node_ptr pNode( alloc_node( std::forward( key ))); - if ( base_class::insert_at( &refHead, *pNode, [&f](node_type& node){ f( node_to_value(node) ); } )) { + if ( base_class::insert_at( &refHead, *pNode, [&f](node_type& node){ f( node_to_value(node)); } )) { pNode.release(); return true; } @@ -795,7 +795,7 @@ namespace cds { namespace container { template bool erase_at( head_type& refHead, Q const& key, Compare cmp, Func f ) { - return base_class::erase_at( &refHead, key, cmp, [&f](node_type const& node){ f( node_to_value(node) ); } ); + return base_class::erase_at( &refHead, key, cmp, [&f](node_type const& node){ f( node_to_value(node)); } ); } template diff --git a/cds/container/michael_kvlist_nogc.h b/cds/container/michael_kvlist_nogc.h index bc300bb1..43c3e1f1 100644 --- a/cds/container/michael_kvlist_nogc.h +++ b/cds/container/michael_kvlist_nogc.h @@ -270,7 +270,7 @@ namespace cds { namespace container { */ iterator begin() { - return iterator( head() ); + return iterator( head()); } /// Returns an iterator that addresses the location succeeding the last element in a list @@ -289,12 +289,12 @@ namespace cds { namespace container { /// Returns a forward const iterator addressing the first element in a list const_iterator begin() const { - return const_iterator( head() ); + return const_iterator( head()); } /// Returns a forward const iterator addressing the first element in a list const_iterator cbegin() const { - return const_iterator( head() ); + return const_iterator( head()); } /// Returns an const iterator that addresses the location succeeding the last element in a list @@ -446,7 +446,7 @@ namespace cds { namespace container { template iterator contains( Q const& key ) { - return node_to_iterator( find_at( head(), key, intrusive_key_comparator() ) ); + return node_to_iterator( find_at( head(), key, intrusive_key_comparator()) ); } //@cond template @@ -467,7 +467,7 @@ namespace cds { namespace container { iterator contains( Q const& key, Less pred ) { CDS_UNUSED( pred ); - return node_to_iterator( find_at( head(), key, typename maker::template less_wrapper::type() ) ); + return node_to_iterator( find_at( head(), key, typename maker::template less_wrapper::type()) ); } //@cond template diff --git a/cds/container/michael_kvlist_rcu.h b/cds/container/michael_kvlist_rcu.h index 6b6c8ae6..427fde9b 100644 --- a/cds/container/michael_kvlist_rcu.h +++ b/cds/container/michael_kvlist_rcu.h @@ -302,7 +302,7 @@ namespace cds { namespace container { */ iterator begin() { - return iterator( head() ); + return iterator( head()); } /// Returns an iterator that addresses the location succeeding the last element in a list @@ -321,12 +321,12 @@ namespace cds { namespace container { /// Returns a forward const iterator addressing the first element in a list const_iterator begin() const { - return const_iterator( head() ); + return const_iterator( head()); } /// Returns a forward const iterator addressing the first element in a list const_iterator cbegin() const { - return const_iterator( head() ); + return const_iterator( head()); } /// Returns an const iterator that addresses the location succeeding the last element in a list @@ -539,7 +539,7 @@ namespace cds { namespace container { template bool erase( K const& key ) { - return erase_at( head(), key, intrusive_key_comparator() ); + return erase_at( head(), key, intrusive_key_comparator()); } /// Deletes the item from the list using \p pred predicate for searching @@ -553,7 +553,7 @@ namespace cds { namespace container { bool erase_with( K const& key, Less pred ) { CDS_UNUSED( pred ); - return erase_at( head(), key, typename maker::template less_wrapper::type() ); + return erase_at( head(), key, typename maker::template less_wrapper::type()); } /// Deletes \p key from the list @@ -618,7 +618,7 @@ namespace cds { namespace container { rcu_michael_list::exempt_ptr p; // The RCU should NOT be locked when extract() is called! - assert( !rcu::is_locked() ); + assert( !rcu::is_locked()); // extract() call p = theList.extract( 10 ); @@ -635,7 +635,7 @@ namespace cds { namespace container { template exempt_ptr extract( K const& key ) { - return exempt_ptr( extract_at( head(), key, intrusive_key_comparator() )); + return exempt_ptr( extract_at( head(), key, intrusive_key_comparator())); } /// Extracts an item from the list using \p pred predicate for searching @@ -649,7 +649,7 @@ namespace cds { namespace container { exempt_ptr extract_with( K const& key, Less pred ) { CDS_UNUSED( pred ); - return exempt_ptr( extract_at( head(), key, typename maker::template less_wrapper::type() )); + return exempt_ptr( extract_at( head(), key, typename maker::template less_wrapper::type())); } /// Checks whether the list contains \p key @@ -662,7 +662,7 @@ namespace cds { namespace container { template bool contains( Q const& key ) { - return find_at( head(), key, intrusive_key_comparator() ); + return find_at( head(), key, intrusive_key_comparator()); } //@cond template @@ -685,7 +685,7 @@ namespace cds { namespace container { bool contains( Q const& key, Less pred ) { CDS_UNUSED( pred ); - return find_at( head(), key, typename maker::template less_wrapper::type() ); + return find_at( head(), key, typename maker::template less_wrapper::type()); } //@cond template @@ -784,7 +784,7 @@ namespace cds { namespace container { raw_ptr get_with( K const& key, Less pred ) { CDS_UNUSED( pred ); - return get_at( head(), key, typename maker::template less_wrapper::type() ); + return get_at( head(), key, typename maker::template less_wrapper::type()); } /// Checks if the list is empty diff --git a/cds/container/michael_list_nogc.h b/cds/container/michael_list_nogc.h index 2c10de8b..277560b2 100644 --- a/cds/container/michael_list_nogc.h +++ b/cds/container/michael_list_nogc.h @@ -226,7 +226,7 @@ namespace cds { namespace container { */ iterator begin() { - return iterator( head() ); + return iterator( head()); } /// Returns an iterator that addresses the location succeeding the last element in a list @@ -245,13 +245,13 @@ namespace cds { namespace container { /// Returns a forward const iterator addressing the first element in a list const_iterator begin() const { - return const_iterator( head() ); + return const_iterator( head()); } /// Returns a forward const iterator addressing the first element in a list const_iterator cbegin() const { - return const_iterator( head() ); + return const_iterator( head()); } /// Returns an const iterator that addresses the location succeeding the last element in a list @@ -301,7 +301,7 @@ namespace cds { namespace container { template iterator insert( Q&& val ) { - return node_to_iterator( insert_at( head(), std::forward( val )) ); + return node_to_iterator( insert_at( head(), std::forward( val ))); } /// Updates the item @@ -348,7 +348,7 @@ namespace cds { namespace container { template iterator contains( Q const& key ) { - return node_to_iterator( find_at( head(), key, intrusive_key_comparator() )); + return node_to_iterator( find_at( head(), key, intrusive_key_comparator())); } //@cond template @@ -369,7 +369,7 @@ namespace cds { namespace container { iterator contains( Q const& key, Less pred ) { CDS_UNUSED( pred ); - return node_to_iterator( find_at( head(), key, typename maker::template less_wrapper::type() ) ); + return node_to_iterator( find_at( head(), key, typename maker::template less_wrapper::type()) ); } //@cond template diff --git a/cds/container/michael_list_rcu.h b/cds/container/michael_list_rcu.h index bec47781..6aaf2379 100644 --- a/cds/container/michael_list_rcu.h +++ b/cds/container/michael_list_rcu.h @@ -290,7 +290,7 @@ namespace cds { namespace container { */ iterator begin() { - return iterator( head() ); + return iterator( head()); } /// Returns an iterator that addresses the location succeeding the last element in a list @@ -309,13 +309,13 @@ namespace cds { namespace container { /// Returns a forward const iterator addressing the first element in a list const_iterator begin() const { - return const_iterator( head() ); + return const_iterator( head()); } /// Returns a forward const iterator addressing the first element in a list const_iterator cbegin() const { - return const_iterator( head() ); + return const_iterator( head()); } /// Returns an const iterator that addresses the location succeeding the last element in a list @@ -558,7 +558,7 @@ namespace cds { namespace container { rcu_michael_list::exempt_ptr p; // The RCU should NOT be locked when extract() is called! - assert( !rcu::is_locked() ); + assert( !rcu::is_locked()); // extract() call p = theList.extract( 10 ) @@ -575,7 +575,7 @@ namespace cds { namespace container { template exempt_ptr extract( Q const& key ) { - return exempt_ptr( extract_at( head(), key, intrusive_key_comparator() )); + return exempt_ptr( extract_at( head(), key, intrusive_key_comparator())); } /// Extracts an item from the list using \p pred predicate for searching @@ -590,7 +590,7 @@ namespace cds { namespace container { exempt_ptr extract_with( Q const& key, Less pred ) { CDS_UNUSED( pred ); - return exempt_ptr( extract_at( head(), key, typename maker::template less_wrapper::type() )); + return exempt_ptr( extract_at( head(), key, typename maker::template less_wrapper::type())); } /// Checks whether the list contains \p key @@ -603,7 +603,7 @@ namespace cds { namespace container { template bool contains( Q const& key ) { - return find_at( head(), key, intrusive_key_comparator() ); + return find_at( head(), key, intrusive_key_comparator()); } //@cond template @@ -624,7 +624,7 @@ namespace cds { namespace container { bool contains( Q const& key, Less pred ) { CDS_UNUSED( pred ); - return find_at( head(), key, typename maker::template less_wrapper::type() ); + return find_at( head(), key, typename maker::template less_wrapper::type()); } //@cond // Deprecatd, use contains() @@ -804,7 +804,7 @@ namespace cds { namespace container { { scoped_node_ptr pNode( alloc_node( std::forward( key ))); - if ( base_class::insert_at( refHead, *pNode, [&f]( node_type& node ) { f( node_to_value(node) ); } )) { + if ( base_class::insert_at( refHead, *pNode, [&f]( node_type& node ) { f( node_to_value(node)); } )) { pNode.release(); return true; } @@ -820,7 +820,7 @@ namespace cds { namespace container { template bool erase_at( head_type& refHead, Q const& key, Compare cmp, Func f ) { - return base_class::erase_at( refHead, key, cmp, [&f](node_type const& node){ f( node_to_value(node) ); } ); + return base_class::erase_at( refHead, key, cmp, [&f](node_type const& node){ f( node_to_value(node)); } ); } template diff --git a/cds/container/michael_map.h b/cds/container/michael_map.h index 93114703..71287e4d 100644 --- a/cds/container/michael_map.h +++ b/cds/container/michael_map.h @@ -64,7 +64,7 @@ namespace cds { namespace container { \p key_type and an argument of template type \p K must meet the following requirements: - \p key_type should be constructible from value of type \p K; - the hash functor should be able to calculate correct hash value from argument \p key of type \p K: - hash( key_type(key) ) == hash( key ) + hash( key_type(key)) == hash( key ) - values of type \p key_type and \p K should be comparable There are the specializations: @@ -349,7 +349,7 @@ namespace cds { namespace container { */ iterator begin() { - return iterator( bucket_begin()->begin(), bucket_begin(), bucket_end() ); + return iterator( bucket_begin()->begin(), bucket_begin(), bucket_end()); } /// Returns an iterator that addresses the location succeeding the last element in a map @@ -360,7 +360,7 @@ namespace cds { namespace container { */ iterator end() { - return iterator( bucket_end()[-1].end(), bucket_end() - 1, bucket_end() ); + return iterator( bucket_end()[-1].end(), bucket_end() - 1, bucket_end()); } /// Returns a forward const iterator addressing the first element in a map @@ -402,7 +402,7 @@ namespace cds { namespace container { size_t nLoadFactor ///< load factor: estimation of max number of items in the bucket ) : m_nHashBitmask( michael_map::details::init_hash_bitmask( nMaxItemCount, nLoadFactor )) - , m_Buckets( bucket_table_allocator().allocate( bucket_count() ) ) + , m_Buckets( bucket_table_allocator().allocate( bucket_count()) ) { for ( auto it = m_Buckets, itEnd = m_Buckets + bucket_count(); it != itEnd; ++it ) construct_bucket( it ); @@ -415,7 +415,7 @@ namespace cds { namespace container { for ( auto it = m_Buckets, itEnd = m_Buckets + bucket_count(); it != itEnd; ++it ) it->~internal_bucket_type(); - bucket_table_allocator().deallocate( m_Buckets, bucket_count() ); + bucket_table_allocator().deallocate( m_Buckets, bucket_count()); } /// Inserts new node with key and default value @@ -768,7 +768,7 @@ namespace cds { namespace container { { auto& b = bucket( key ); auto it = b.find( key ); - if ( it == b.end() ) + if ( it == b.end()) return end(); return iterator( it, &b, bucket_end()); } @@ -807,9 +807,9 @@ namespace cds { namespace container { { auto& b = bucket( key ); auto it = b.find_with( key, pred ); - if ( it == b.end() ) + if ( it == b.end()) return end(); - return iterator( it, &b, bucket_end() ); + return iterator( it, &b, bucket_end()); } /// Checks whether the map contains \p key @@ -954,11 +954,11 @@ namespace cds { namespace container { const_iterator get_const_begin() const { - return const_iterator( bucket_begin()->cbegin(), bucket_begin(), bucket_end() ); + return const_iterator( bucket_begin()->cbegin(), bucket_begin(), bucket_end()); } const_iterator get_const_end() const { - return const_iterator( (bucket_end() - 1)->cend(), bucket_end() - 1, bucket_end() ); + return const_iterator( (bucket_end() - 1)->cend(), bucket_end() - 1, bucket_end()); } template diff --git a/cds/container/michael_map_nogc.h b/cds/container/michael_map_nogc.h index 99fad9eb..e3e010da 100644 --- a/cds/container/michael_map_nogc.h +++ b/cds/container/michael_map_nogc.h @@ -249,7 +249,7 @@ namespace cds { namespace container { */ iterator begin() { - return iterator( m_Buckets[0].begin(), m_Buckets, m_Buckets + bucket_count() ); + return iterator( m_Buckets[0].begin(), m_Buckets, m_Buckets + bucket_count()); } /// Returns an iterator that addresses the location succeeding the last element in a set @@ -260,7 +260,7 @@ namespace cds { namespace container { */ iterator end() { - return iterator( m_Buckets[bucket_count() - 1].end(), m_Buckets + bucket_count() - 1, m_Buckets + bucket_count() ); + return iterator( m_Buckets[bucket_count() - 1].end(), m_Buckets + bucket_count() - 1, m_Buckets + bucket_count()); } /// Returns a forward const iterator addressing the first element in a set @@ -315,7 +315,7 @@ namespace cds { namespace container { clear(); for ( auto it = m_Buckets, itEnd = m_Buckets + bucket_count(); it != itEnd; ++it ) it->~internal_bucket_type(); - bucket_table_allocator().deallocate( m_Buckets, bucket_count() ); + bucket_table_allocator().deallocate( m_Buckets, bucket_count()); } /// Inserts new node with key and default value @@ -335,9 +335,9 @@ namespace cds { namespace container { internal_bucket_type& refBucket = bucket( key ); bucket_iterator it = refBucket.insert( key ); - if ( it != refBucket.end() ) { + if ( it != refBucket.end()) { ++m_ItemCounter; - return iterator( it, &refBucket, m_Buckets + bucket_count() ); + return iterator( it, &refBucket, m_Buckets + bucket_count()); } return end(); @@ -360,9 +360,9 @@ namespace cds { namespace container { internal_bucket_type& refBucket = bucket( key ); bucket_iterator it = refBucket.insert( key, val ); - if ( it != refBucket.end() ) { + if ( it != refBucket.end()) { ++m_ItemCounter; - return iterator( it, &refBucket, m_Buckets + bucket_count() ); + return iterator( it, &refBucket, m_Buckets + bucket_count()); } return end(); @@ -404,9 +404,9 @@ namespace cds { namespace container { internal_bucket_type& refBucket = bucket( key ); bucket_iterator it = refBucket.insert_with( key, func ); - if ( it != refBucket.end() ) { + if ( it != refBucket.end()) { ++m_ItemCounter; - return iterator( it, &refBucket, m_Buckets + bucket_count() ); + return iterator( it, &refBucket, m_Buckets + bucket_count()); } return end(); @@ -424,9 +424,9 @@ namespace cds { namespace container { internal_bucket_type& refBucket = bucket( key ); bucket_iterator it = refBucket.emplace( std::forward(key), std::forward(args)... ); - if ( it != refBucket.end() ) { + if ( it != refBucket.end()) { ++m_ItemCounter; - return iterator( it, &refBucket, m_Buckets + bucket_count() ); + return iterator( it, &refBucket, m_Buckets + bucket_count()); } return end(); @@ -455,9 +455,9 @@ namespace cds { namespace container { if ( ret.second ) ++m_ItemCounter; - else if ( ret.first == refBucket.end() ) + else if ( ret.first == refBucket.end()) return std::make_pair( end(), false ); - return std::make_pair( iterator( ret.first, &refBucket, m_Buckets + bucket_count() ), ret.second ); + return std::make_pair( iterator( ret.first, &refBucket, m_Buckets + bucket_count()), ret.second ); } //@cond template @@ -479,8 +479,8 @@ namespace cds { namespace container { internal_bucket_type& refBucket = bucket( key ); bucket_iterator it = refBucket.contains( key ); - if ( it != refBucket.end() ) - return iterator( it, &refBucket, m_Buckets + bucket_count() ); + if ( it != refBucket.end()) + return iterator( it, &refBucket, m_Buckets + bucket_count()); return end(); } @@ -506,8 +506,8 @@ namespace cds { namespace container { internal_bucket_type& refBucket = bucket( key ); bucket_iterator it = refBucket.contains( key, pred ); - if ( it != refBucket.end() ) - return iterator( it, &refBucket, m_Buckets + bucket_count() ); + if ( it != refBucket.end()) + return iterator( it, &refBucket, m_Buckets + bucket_count()); return end(); } @@ -582,11 +582,11 @@ namespace cds { namespace container { //@cond const_iterator get_const_begin() const { - return const_iterator( const_cast(m_Buckets[0]).begin(), m_Buckets, m_Buckets + bucket_count() ); + return const_iterator( const_cast(m_Buckets[0]).begin(), m_Buckets, m_Buckets + bucket_count()); } const_iterator get_const_end() const { - return const_iterator( const_cast(m_Buckets[bucket_count() - 1]).end(), m_Buckets + bucket_count() - 1, m_Buckets + bucket_count() ); + return const_iterator( const_cast(m_Buckets[bucket_count() - 1]).end(), m_Buckets + bucket_count() - 1, m_Buckets + bucket_count()); } template diff --git a/cds/container/michael_map_rcu.h b/cds/container/michael_map_rcu.h index cfda210b..cc0fba5e 100644 --- a/cds/container/michael_map_rcu.h +++ b/cds/container/michael_map_rcu.h @@ -61,7 +61,7 @@ namespace cds { namespace container { \p key_type and an argument of template type \p K must meet the following requirements: - \p key_type should be constructible from value of type \p K; - the hash functor should be able to calculate correct hash value from argument \p key of type \p K: - hash( key_type(key) ) == hash( key ) + hash( key_type(key)) == hash( key ) - values of type \p key_type and \p K should be comparable How to use @@ -283,7 +283,7 @@ namespace cds { namespace container { */ iterator begin() { - return iterator( m_Buckets[0].begin(), m_Buckets, m_Buckets + bucket_count() ); + return iterator( m_Buckets[0].begin(), m_Buckets, m_Buckets + bucket_count()); } /// Returns an iterator that addresses the location succeeding the last element in a map @@ -294,7 +294,7 @@ namespace cds { namespace container { */ iterator end() { - return iterator( m_Buckets[bucket_count() - 1].end(), m_Buckets + bucket_count() - 1, m_Buckets + bucket_count() ); + return iterator( m_Buckets[bucket_count() - 1].end(), m_Buckets + bucket_count() - 1, m_Buckets + bucket_count()); } /// Returns a forward const iterator addressing the first element in a map @@ -349,7 +349,7 @@ namespace cds { namespace container { clear(); for ( auto it = m_Buckets, itEnd = m_Buckets + bucket_count(); it != itEnd; ++it ) it->~internal_bucket_type(); - bucket_table_allocator().deallocate( m_Buckets, bucket_count() ); + bucket_table_allocator().deallocate( m_Buckets, bucket_count()); } /// Inserts new node with key and default value @@ -847,11 +847,11 @@ namespace cds { namespace container { //@cond const_iterator get_const_begin() const { - return const_iterator( const_cast(m_Buckets[0]).begin(), m_Buckets, m_Buckets + bucket_count() ); + return const_iterator( const_cast(m_Buckets[0]).begin(), m_Buckets, m_Buckets + bucket_count()); } const_iterator get_const_end() const { - return const_iterator( const_cast(m_Buckets[bucket_count() - 1]).end(), m_Buckets + bucket_count() - 1, m_Buckets + bucket_count() ); + return const_iterator( const_cast(m_Buckets[bucket_count() - 1]).end(), m_Buckets + bucket_count() - 1, m_Buckets + bucket_count()); } template diff --git a/cds/container/michael_set.h b/cds/container/michael_set.h index c67a7f0b..81823a23 100644 --- a/cds/container/michael_set.h +++ b/cds/container/michael_set.h @@ -332,7 +332,7 @@ namespace cds { namespace container { size_t nMaxItemCount, ///< estimation of max item count in the hash set size_t nLoadFactor ///< load factor: estimation of max number of items in the bucket ) : m_nHashBitmask( michael_set::details::init_hash_bitmask( nMaxItemCount, nLoadFactor )) - , m_Buckets( bucket_table_allocator().allocate( bucket_count() ) ) + , m_Buckets( bucket_table_allocator().allocate( bucket_count()) ) { for ( auto it = m_Buckets, itEnd = m_Buckets + bucket_count(); it != itEnd; ++it ) construct_bucket( it ); @@ -345,7 +345,7 @@ namespace cds { namespace container { for ( auto it = m_Buckets, itEnd = m_Buckets + bucket_count(); it != itEnd; ++it ) it->~internal_bucket_type(); - bucket_table_allocator().deallocate( m_Buckets, bucket_count() ); + bucket_table_allocator().deallocate( m_Buckets, bucket_count()); } /// Inserts new node @@ -676,7 +676,7 @@ namespace cds { namespace container { { internal_bucket_type& b = bucket( key ); typename internal_bucket_type::iterator it = b.find( key ); - if ( it == b.end() ) + if ( it == b.end()) return end(); return iterator( it, &b, bucket_end()); } @@ -687,9 +687,9 @@ namespace cds { namespace container { { internal_bucket_type& b = bucket( key ); typename internal_bucket_type::iterator it = b.find( key ); - if ( it == b.end() ) + if ( it == b.end()) return end(); - return iterator( it, &b, bucket_end() ); + return iterator( it, &b, bucket_end()); } //@endcond @@ -732,9 +732,9 @@ namespace cds { namespace container { { internal_bucket_type& b = bucket( key ); typename internal_bucket_type::iterator it = b.find_with( key, pred ); - if ( it == b.end() ) + if ( it == b.end()) return end(); - return iterator( it, &b, bucket_end() ); + return iterator( it, &b, bucket_end()); } //@cond template @@ -743,9 +743,9 @@ namespace cds { namespace container { { internal_bucket_type& b = bucket( key ); typename internal_bucket_type::iterator it = b.find_with( key, pred ); - if ( it == b.end() ) + if ( it == b.end()) return end(); - return iterator( it, &b, bucket_end() ); + return iterator( it, &b, bucket_end()); } //@endcond @@ -907,11 +907,11 @@ namespace cds { namespace container { const_iterator get_const_begin() const { - return const_iterator( bucket_begin()->cbegin(), bucket_begin(), bucket_end() ); + return const_iterator( bucket_begin()->cbegin(), bucket_begin(), bucket_end()); } const_iterator get_const_end() const { - return const_iterator(( bucket_end() -1 )->cend(), bucket_end() - 1, bucket_end() ); + return const_iterator(( bucket_end() -1 )->cend(), bucket_end() - 1, bucket_end()); } template diff --git a/cds/container/michael_set_nogc.h b/cds/container/michael_set_nogc.h index 3e3231dc..a921ff43 100644 --- a/cds/container/michael_set_nogc.h +++ b/cds/container/michael_set_nogc.h @@ -172,7 +172,7 @@ namespace cds { namespace container { */ iterator begin() { - return iterator( m_Buckets[0].begin(), m_Buckets, m_Buckets + bucket_count() ); + return iterator( m_Buckets[0].begin(), m_Buckets, m_Buckets + bucket_count()); } /// Returns an iterator that addresses the location succeeding the last element in a set @@ -183,7 +183,7 @@ namespace cds { namespace container { */ iterator end() { - return iterator( m_Buckets[bucket_count() - 1].end(), m_Buckets + bucket_count() - 1, m_Buckets + bucket_count() ); + return iterator( m_Buckets[bucket_count() - 1].end(), m_Buckets + bucket_count() - 1, m_Buckets + bucket_count()); } /// Returns a forward const iterator addressing the first element in a set @@ -225,7 +225,7 @@ namespace cds { namespace container { size_t nMaxItemCount, ///< estimation of max item count in the hash set size_t nLoadFactor ///< load factor: estimation of max number of items in the bucket ) : m_nHashBitmask( michael_set::details::init_hash_bitmask( nMaxItemCount, nLoadFactor )) - , m_Buckets( bucket_table_allocator().allocate( bucket_count() ) ) + , m_Buckets( bucket_table_allocator().allocate( bucket_count()) ) { for ( auto it = m_Buckets, itEnd = m_Buckets + bucket_count(); it != itEnd; ++it ) construct_bucket( it ); @@ -237,7 +237,7 @@ namespace cds { namespace container { clear(); for ( auto it = m_Buckets, itEnd = m_Buckets + bucket_count(); it != itEnd; ++it ) it->~internal_bucket_type(); - bucket_table_allocator().deallocate( m_Buckets, bucket_count() ); + bucket_table_allocator().deallocate( m_Buckets, bucket_count()); } /// Inserts new node @@ -253,9 +253,9 @@ namespace cds { namespace container { internal_bucket_type& refBucket = bucket( val ); bucket_iterator it = refBucket.insert( val ); - if ( it != refBucket.end() ) { + if ( it != refBucket.end()) { ++m_ItemCounter; - return iterator( it, &refBucket, m_Buckets + bucket_count() ); + return iterator( it, &refBucket, m_Buckets + bucket_count()); } return end(); @@ -271,9 +271,9 @@ namespace cds { namespace container { typename internal_bucket_type::node_type * pNode = internal_bucket_type::alloc_node( std::forward( args )... ); internal_bucket_type& refBucket = bucket( internal_bucket_type::node_to_value( *pNode )); bucket_iterator it = refBucket.insert_node( pNode ); - if ( it != refBucket.end() ) { + if ( it != refBucket.end()) { ++m_ItemCounter; - return iterator( it, &refBucket, m_Buckets + bucket_count() ); + return iterator( it, &refBucket, m_Buckets + bucket_count()); } return end(); @@ -300,10 +300,10 @@ namespace cds { namespace container { internal_bucket_type& refBucket = bucket( val ); std::pair ret = refBucket.update( val, bAllowInsert ); - if ( ret.first != refBucket.end() ) { + if ( ret.first != refBucket.end()) { if ( ret.second ) ++m_ItemCounter; - return std::make_pair( iterator( ret.first, &refBucket, m_Buckets + bucket_count() ), ret.second ); + return std::make_pair( iterator( ret.first, &refBucket, m_Buckets + bucket_count()), ret.second ); } return std::make_pair( end(), ret.second ); } @@ -330,8 +330,8 @@ namespace cds { namespace container { { internal_bucket_type& refBucket = bucket( key ); bucket_iterator it = refBucket.contains( key ); - if ( it != refBucket.end() ) - return iterator( it, &refBucket, m_Buckets + bucket_count() ); + if ( it != refBucket.end()) + return iterator( it, &refBucket, m_Buckets + bucket_count()); return end(); } @@ -355,8 +355,8 @@ namespace cds { namespace container { { internal_bucket_type& refBucket = bucket( key ); bucket_iterator it = refBucket.contains( key, pred ); - if ( it != refBucket.end() ) - return iterator( it, &refBucket, m_Buckets + bucket_count() ); + if ( it != refBucket.end()) + return iterator( it, &refBucket, m_Buckets + bucket_count()); return end(); } @@ -443,11 +443,11 @@ namespace cds { namespace container { const_iterator get_const_begin() const { - return const_iterator( const_cast(m_Buckets[0]).begin(), m_Buckets, m_Buckets + bucket_count() ); + return const_iterator( const_cast(m_Buckets[0]).begin(), m_Buckets, m_Buckets + bucket_count()); } const_iterator get_const_end() const { - return const_iterator( const_cast(m_Buckets[bucket_count() - 1]).end(), m_Buckets + bucket_count() - 1, m_Buckets + bucket_count() ); + return const_iterator( const_cast(m_Buckets[bucket_count() - 1]).end(), m_Buckets + bucket_count() - 1, m_Buckets + bucket_count()); } //@endcond }; diff --git a/cds/container/michael_set_rcu.h b/cds/container/michael_set_rcu.h index 7b5249cf..9733f4c9 100644 --- a/cds/container/michael_set_rcu.h +++ b/cds/container/michael_set_rcu.h @@ -249,7 +249,7 @@ namespace cds { namespace container { */ iterator begin() { - return iterator( m_Buckets[0].begin(), m_Buckets, m_Buckets + bucket_count() ); + return iterator( m_Buckets[0].begin(), m_Buckets, m_Buckets + bucket_count()); } /// Returns an iterator that addresses the location succeeding the last element in a set @@ -260,7 +260,7 @@ namespace cds { namespace container { */ iterator end() { - return iterator( m_Buckets[bucket_count() - 1].end(), m_Buckets + bucket_count() - 1, m_Buckets + bucket_count() ); + return iterator( m_Buckets[bucket_count() - 1].end(), m_Buckets + bucket_count() - 1, m_Buckets + bucket_count()); } /// Returns a forward const iterator addressing the first element in a set @@ -302,7 +302,7 @@ namespace cds { namespace container { size_t nMaxItemCount, ///< estimation of max item count in the hash set size_t nLoadFactor ///< load factor: estimation of max number of items in the bucket ) : m_nHashBitmask( michael_set::details::init_hash_bitmask( nMaxItemCount, nLoadFactor )) - , m_Buckets( bucket_table_allocator().allocate( bucket_count() ) ) + , m_Buckets( bucket_table_allocator().allocate( bucket_count()) ) { for ( auto it = m_Buckets, itEnd = m_Buckets + bucket_count(); it != itEnd; ++it ) construct_bucket( it ); @@ -315,7 +315,7 @@ namespace cds { namespace container { for ( auto it = m_Buckets, itEnd = m_Buckets + bucket_count(); it != itEnd; ++it ) it->~internal_bucket_type(); - bucket_table_allocator().deallocate( m_Buckets, bucket_count() ); + bucket_table_allocator().deallocate( m_Buckets, bucket_count()); } @@ -425,7 +425,7 @@ namespace cds { namespace container { bool emplace( Args&&... args ) { typename internal_bucket_type::node_type * pNode = internal_bucket_type::alloc_node( std::forward( args )... ); - bool bRet = bucket( internal_bucket_type::node_to_value( *pNode ) ).insert_node( pNode ); + bool bRet = bucket( internal_bucket_type::node_to_value( *pNode )).insert_node( pNode ); if ( bRet ) ++m_ItemCounter; return bRet; @@ -809,11 +809,11 @@ namespace cds { namespace container { const_iterator get_const_begin() const { - return const_iterator( const_cast(m_Buckets[0]).begin(), m_Buckets, m_Buckets + bucket_count() ); + return const_iterator( const_cast(m_Buckets[0]).begin(), m_Buckets, m_Buckets + bucket_count()); } const_iterator get_const_end() const { - return const_iterator( const_cast(m_Buckets[bucket_count() - 1]).end(), m_Buckets + bucket_count() - 1, m_Buckets + bucket_count() ); + return const_iterator( const_cast(m_Buckets[bucket_count() - 1]).end(), m_Buckets + bucket_count() - 1, m_Buckets + bucket_count()); } //@endcond }; diff --git a/cds/container/moir_queue.h b/cds/container/moir_queue.h index bcd491f7..bf2d7729 100644 --- a/cds/container/moir_queue.h +++ b/cds/container/moir_queue.h @@ -159,7 +159,7 @@ namespace cds { namespace container { */ bool enqueue( value_type const& val ) { - scoped_node_ptr p( alloc_node(val) ); + scoped_node_ptr p( alloc_node(val)); if ( base_class::enqueue( *p )) { p.release(); return true; @@ -171,7 +171,7 @@ namespace cds { namespace container { bool enqueue( value_type&& val ) { scoped_node_ptr p( alloc_node_move( std::move( val ))); - if ( base_class::enqueue( *p ) ) { + if ( base_class::enqueue( *p )) { p.release(); return true; } @@ -192,7 +192,7 @@ namespace cds { namespace container { template bool enqueue_with( Func f ) { - scoped_node_ptr p( alloc_node() ); + scoped_node_ptr p( alloc_node()); f( p->m_value ); if ( base_class::enqueue( *p )) { p.release(); @@ -205,8 +205,8 @@ namespace cds { namespace container { template bool emplace( Args&&... args ) { - scoped_node_ptr p( alloc_node_move( std::forward( args )... ) ); - if ( base_class::enqueue( *p ) ) { + scoped_node_ptr p( alloc_node_move( std::forward( args )... )); + if ( base_class::enqueue( *p )) { p.release(); return true; } diff --git a/cds/container/mspriority_queue.h b/cds/container/mspriority_queue.h index 6cafacb2..160cead2 100644 --- a/cds/container/mspriority_queue.h +++ b/cds/container/mspriority_queue.h @@ -189,7 +189,7 @@ namespace cds { namespace container { bool push( value_type const& val ) { scoped_ptr pVal( cxx_allocator().New( val )); - if ( base_class::push( *(pVal.get()) )) { + if ( base_class::push( *(pVal.get()))) { pVal.release(); return true; } @@ -209,7 +209,7 @@ namespace cds { namespace container { template bool push_with( Func f ) { - scoped_ptr pVal( cxx_allocator().New() ); + scoped_ptr pVal( cxx_allocator().New()); f( *pVal ); if ( base_class::push( *pVal )) { pVal.release(); @@ -229,7 +229,7 @@ namespace cds { namespace container { bool emplace( Args&&... args ) { scoped_ptr pVal( cxx_allocator().MoveNew( std::forward(args)... )); - if ( base_class::push( *(pVal.get()) )) { + if ( base_class::push( *(pVal.get()))) { pVal.release(); return true; } diff --git a/cds/container/msqueue.h b/cds/container/msqueue.h index ba97d588..b79cff66 100644 --- a/cds/container/msqueue.h +++ b/cds/container/msqueue.h @@ -275,8 +275,8 @@ namespace cds { namespace container { */ bool enqueue( value_type const& val ) { - scoped_node_ptr p( alloc_node(val) ); - if ( base_class::enqueue( *p ) ) { + scoped_node_ptr p( alloc_node(val)); + if ( base_class::enqueue( *p )) { p.release(); return true; } @@ -287,7 +287,7 @@ namespace cds { namespace container { bool enqueue( value_type&& val ) { scoped_node_ptr p( alloc_node_move( std::move( val ))); - if ( base_class::enqueue( *p ) ) { + if ( base_class::enqueue( *p )) { p.release(); return true; } @@ -307,7 +307,7 @@ namespace cds { namespace container { template bool enqueue_with( Func f ) { - scoped_node_ptr p( alloc_node() ); + scoped_node_ptr p( alloc_node()); f( p->m_value ); if ( base_class::enqueue( *p )) { p.release(); @@ -320,8 +320,8 @@ namespace cds { namespace container { template bool emplace( Args&&... args ) { - scoped_node_ptr p( alloc_node_move( std::forward( args )... ) ); - if ( base_class::enqueue( *p ) ) { + scoped_node_ptr p( alloc_node_move( std::forward( args )... )); + if ( base_class::enqueue( *p )) { p.release(); return true; } diff --git a/cds/container/optimistic_queue.h b/cds/container/optimistic_queue.h index 1506f6f0..1b29f9df 100644 --- a/cds/container/optimistic_queue.h +++ b/cds/container/optimistic_queue.h @@ -287,7 +287,7 @@ namespace cds { namespace container { bool enqueue( value_type&& val ) { scoped_node_ptr p( alloc_node_move( std::move( val ))); - if ( base_class::enqueue( *p ) ) { + if ( base_class::enqueue( *p )) { p.release(); return true; } @@ -307,7 +307,7 @@ namespace cds { namespace container { template bool enqueue_with( Func f ) { - scoped_node_ptr p( alloc_node() ); + scoped_node_ptr p( alloc_node()); f( p->m_value ); if ( base_class::enqueue( *p )) { p.release(); @@ -374,7 +374,7 @@ namespace cds { namespace container { bool dequeue_with( Func f ) { typename base_class::dequeue_result res; - if ( base_class::do_dequeue( res ) ) { + if ( base_class::do_dequeue( res )) { f( node_traits::to_value_ptr( *res.pNext )->m_value ); base_class::dispose_result( res ); diff --git a/cds/container/rwqueue.h b/cds/container/rwqueue.h index 5332e311..028a08b7 100644 --- a/cds/container/rwqueue.h +++ b/cds/container/rwqueue.h @@ -245,7 +245,7 @@ namespace cds { namespace container { bool enqueue( value_type const& data ) { scoped_node_ptr p( alloc_node( data )); - if ( enqueue_node( p.get() )) { + if ( enqueue_node( p.get())) { p.release(); return true; } @@ -256,7 +256,7 @@ namespace cds { namespace container { bool enqueue( value_type&& data ) { scoped_node_ptr p( alloc_node_move( std::move( data ))); - if ( enqueue_node( p.get() ) ) { + if ( enqueue_node( p.get()) ) { p.release(); return true; } @@ -276,9 +276,9 @@ namespace cds { namespace container { template bool enqueue_with( Func f ) { - scoped_node_ptr p( alloc_node() ); + scoped_node_ptr p( alloc_node()); f( p->m_value ); - if ( enqueue_node( p.get() )) { + if ( enqueue_node( p.get())) { p.release(); return true; } @@ -290,7 +290,7 @@ namespace cds { namespace container { bool emplace( Args&&... args ) { scoped_node_ptr p( alloc_node_move( std::forward(args)... )); - if ( enqueue_node( p.get() )) { + if ( enqueue_node( p.get())) { p.release(); return true; } diff --git a/cds/container/segmented_queue.h b/cds/container/segmented_queue.h index fe6977ba..89c6eb24 100644 --- a/cds/container/segmented_queue.h +++ b/cds/container/segmented_queue.h @@ -273,8 +273,8 @@ namespace cds { namespace container { */ bool enqueue( value_type const& val ) { - scoped_node_ptr p( alloc_node(val) ); - if ( base_class::enqueue( *p ) ) { + scoped_node_ptr p( alloc_node(val)); + if ( base_class::enqueue( *p )) { p.release(); return true; } @@ -285,7 +285,7 @@ namespace cds { namespace container { bool enqueue( value_type&& val ) { scoped_node_ptr p( alloc_node_move( std::move( val ))); - if ( base_class::enqueue( *p ) ) { + if ( base_class::enqueue( *p )) { p.release(); return true; } @@ -305,9 +305,9 @@ namespace cds { namespace container { template bool enqueue_with( Func f ) { - scoped_node_ptr p( alloc_node() ); + scoped_node_ptr p( alloc_node()); f( *p ); - if ( base_class::enqueue( *p ) ) { + if ( base_class::enqueue( *p )) { p.release(); return true; } @@ -338,7 +338,7 @@ namespace cds { namespace container { template bool emplace( Args&&... args ) { - scoped_node_ptr p( alloc_node_move( std::forward(args)... ) ); + scoped_node_ptr p( alloc_node_move( std::forward(args)... )); if ( base_class::enqueue( *p )) { p.release(); return true; diff --git a/cds/container/skip_list_map_nogc.h b/cds/container/skip_list_map_nogc.h index 73fd275d..388cf46b 100644 --- a/cds/container/skip_list_map_nogc.h +++ b/cds/container/skip_list_map_nogc.h @@ -196,7 +196,7 @@ namespace cds { namespace container { iterator insert( K const& key ) { //TODO: pass arguments by reference (make_pair makes copy) - return base_class::insert( std::make_pair( key_type( key ), mapped_type() ) ); + return base_class::insert( std::make_pair( key_type( key ), mapped_type()) ); } /// Inserts new node @@ -248,8 +248,8 @@ namespace cds { namespace container { iterator insert_with( K const& key, Func func ) { iterator it = insert( key ); - if ( it != end() ) - func( (*it) ); + if ( it != end()) + func( (*it)); return it; } @@ -278,7 +278,7 @@ namespace cds { namespace container { std::pair update( K const& key, bool bInsert = true ) { //TODO: pass arguments by reference (make_pair makes copy) - return base_class::update( std::make_pair( key_type( key ), mapped_type() ), bInsert ); + return base_class::update( std::make_pair( key_type( key ), mapped_type()), bInsert ); } //@cond template diff --git a/cds/container/skip_list_map_rcu.h b/cds/container/skip_list_map_rcu.h index 2e8d2666..0470477d 100644 --- a/cds/container/skip_list_map_rcu.h +++ b/cds/container/skip_list_map_rcu.h @@ -231,7 +231,7 @@ namespace cds { namespace container { /// Returns a forward iterator addressing the first element in a map iterator begin() { - return iterator( base_class::begin() ); + return iterator( base_class::begin()); } /// Returns a forward const iterator addressing the first element in a map @@ -242,13 +242,13 @@ namespace cds { namespace container { /// Returns a forward const iterator addressing the first element in a map const_iterator cbegin() const { - return const_iterator( base_class::cbegin() ); + return const_iterator( base_class::cbegin()); } /// Returns a forward iterator that addresses the location succeeding the last element in a map. iterator end() { - return iterator( base_class::end() ); + return iterator( base_class::end()); } /// Returns a forward const iterator that addresses the location succeeding the last element in a map. @@ -259,7 +259,7 @@ namespace cds { namespace container { /// Returns a forward const iterator that addresses the location succeeding the last element in a map. const_iterator cend() const { - return const_iterator( base_class::cend() ); + return const_iterator( base_class::cend()); } //@} @@ -612,7 +612,7 @@ namespace cds { namespace container { bool contains( K const& key, Less pred ) { CDS_UNUSED( pred ); - return base_class::contains( key, cds::details::predicate_wrapper< node_type, Less, typename maker::key_accessor >() ); + return base_class::contains( key, cds::details::predicate_wrapper< node_type, Less, typename maker::key_accessor >()); } //@cond template @@ -671,7 +671,7 @@ namespace cds { namespace container { raw_ptr get_with( K const& key, Less pred ) { CDS_UNUSED( pred ); - return raw_ptr( base_class::get_with( key, cds::details::predicate_wrapper< node_type, Less, typename maker::key_accessor >() )); + return raw_ptr( base_class::get_with( key, cds::details::predicate_wrapper< node_type, Less, typename maker::key_accessor >())); } /// Clears the map (not atomic) diff --git a/cds/container/skip_list_set_nogc.h b/cds/container/skip_list_set_nogc.h index 7581734e..5f763615 100644 --- a/cds/container/skip_list_set_nogc.h +++ b/cds/container/skip_list_set_nogc.h @@ -215,36 +215,36 @@ namespace cds { namespace container { /// Returns a forward iterator addressing the first element in a set iterator begin() { - return iterator( base_class::begin() ); + return iterator( base_class::begin()); } /// Returns a forward const iterator addressing the first element in a set const_iterator begin() const { - return const_iterator( base_class::begin() ); + return const_iterator( base_class::begin()); } /// Returns a forward const iterator addressing the first element in a set const_iterator cbegin() const { - return const_iterator( base_class::cbegin() ); + return const_iterator( base_class::cbegin()); } /// Returns a forward iterator that addresses the location succeeding the last element in a set. iterator end() { - return iterator( base_class::end() ); + return iterator( base_class::end()); } /// Returns a forward const iterator that addresses the location succeeding the last element in a set. const_iterator end() const { - return const_iterator( base_class::end() ); + return const_iterator( base_class::end()); } /// Returns a forward const iterator that addresses the location succeeding the last element in a set. const_iterator cend() const { - return const_iterator( base_class::cend() ); + return const_iterator( base_class::cend()); } //@} @@ -278,8 +278,8 @@ namespace cds { namespace container { iterator insert( const Q& val ) { scoped_node_ptr sp( node_allocator().New( base_class::random_level(), val )); - if ( base_class::insert( *sp.get() )) { - return node_to_iterator( sp.release() ); + if ( base_class::insert( *sp.get())) { + return node_to_iterator( sp.release()); } return end(); } @@ -292,8 +292,8 @@ namespace cds { namespace container { iterator emplace( Args&&... args ) { scoped_node_ptr sp( node_allocator().New( base_class::random_level(), std::forward(args)... )); - if ( base_class::insert( *sp.get() )) { - return node_to_iterator( sp.release() ); + if ( base_class::insert( *sp.get())) { + return node_to_iterator( sp.release()); } return end(); } @@ -362,7 +362,7 @@ namespace cds { namespace container { iterator contains( Q const& key, Less pred ) const { CDS_UNUSED( pred ); - node_type * pNode = base_class::contains( key, cds::details::predicate_wrapper< node_type, Less, key_accessor>() ); + node_type * pNode = base_class::contains( key, cds::details::predicate_wrapper< node_type, Less, key_accessor>()); if ( pNode ) return node_to_iterator( pNode ); return base_class::nonconst_end(); diff --git a/cds/container/skip_list_set_rcu.h b/cds/container/skip_list_set_rcu.h index 1f2043be..edbfc3b7 100644 --- a/cds/container/skip_list_set_rcu.h +++ b/cds/container/skip_list_set_rcu.h @@ -278,37 +278,37 @@ namespace cds { namespace container { /// Returns a forward iterator addressing the first element in a set iterator begin() { - return iterator( base_class::begin() ); + return iterator( base_class::begin()); } /// Returns a forward const iterator addressing the first element in a set const_iterator begin() const { - return const_iterator( base_class::begin() ); + return const_iterator( base_class::begin()); } /// Returns a forward const iterator addressing the first element in a set const_iterator cbegin() const { - return const_iterator( base_class::cbegin() ); + return const_iterator( base_class::cbegin()); } /// Returns a forward iterator that addresses the location succeeding the last element in a set. iterator end() { - return iterator( base_class::end() ); + return iterator( base_class::end()); } /// Returns a forward const iterator that addresses the location succeeding the last element in a set. const_iterator end() const { - return const_iterator( base_class::end() ); + return const_iterator( base_class::end()); } /// Returns a forward const iterator that addresses the location succeeding the last element in a set. const_iterator cend() const { - return const_iterator( base_class::cend() ); + return const_iterator( base_class::cend()); } //@} @@ -330,7 +330,7 @@ namespace cds { namespace container { bool insert( Q const& val ) { scoped_node_ptr sp( node_allocator().New( random_level(), val )); - if ( base_class::insert( *sp.get() )) { + if ( base_class::insert( *sp.get())) { sp.release(); return true; } @@ -421,7 +421,7 @@ namespace cds { namespace container { bool emplace( Args&&... args ) { scoped_node_ptr sp( node_allocator().New( random_level(), std::forward(args)... )); - if ( base_class::insert( *sp.get() )) { + if ( base_class::insert( *sp.get())) { sp.release(); return true; } @@ -726,7 +726,7 @@ namespace cds { namespace container { raw_ptr get_with( Q const& val, Less pred ) { CDS_UNUSED( pred ); - return raw_ptr( base_class::get_with( val, cds::details::predicate_wrapper< node_type, Less, typename maker::value_accessor >() )); + return raw_ptr( base_class::get_with( val, cds::details::predicate_wrapper< node_type, Less, typename maker::value_accessor >())); } /// Clears the set (non-atomic). @@ -736,7 +736,7 @@ namespace cds { namespace container { this sequence \code set.clear(); - assert( set.empty() ); + assert( set.empty()); \endcode the assertion could be raised. diff --git a/cds/container/split_list_map.h b/cds/container/split_list_map.h index 4295ef8f..45711480 100644 --- a/cds/container/split_list_map.h +++ b/cds/container/split_list_map.h @@ -305,7 +305,7 @@ namespace cds { namespace container { template bool insert( K&& key ) { - return base_class::emplace( key_type( std::forward( key )), mapped_type() ); + return base_class::emplace( key_type( std::forward( key )), mapped_type()); } /// Inserts new node @@ -424,7 +424,7 @@ namespace cds { namespace container { #endif update( K&& key, Func func, bool bAllowInsert = true ) { - typedef decltype( std::make_pair( key_type( std::forward( key )), mapped_type() )) arg_pair_type; + typedef decltype( std::make_pair( key_type( std::forward( key )), mapped_type())) arg_pair_type; return base_class::update( std::make_pair( key_type( key ), mapped_type()), [&func]( bool bNew, value_type& item, arg_pair_type const& /*val*/ ) { @@ -667,7 +667,7 @@ namespace cds { namespace container { find_with( K const& key, Less pred ) { CDS_UNUSED( pred ); - return base_class::find_with( key, cds::details::predicate_wrapper() ); + return base_class::find_with( key, cds::details::predicate_wrapper()); } /// Checks whether the map contains \p key diff --git a/cds/container/split_list_map_nogc.h b/cds/container/split_list_map_nogc.h index b23bacee..82f92375 100644 --- a/cds/container/split_list_map_nogc.h +++ b/cds/container/split_list_map_nogc.h @@ -213,7 +213,7 @@ namespace cds { namespace container { iterator insert( K const& key ) { //TODO: pass arguments by reference (make_pair makes copy) - return base_class::emplace( key_type( key ), mapped_type() ); + return base_class::emplace( key_type( key ), mapped_type()); } /// Inserts new node @@ -265,8 +265,8 @@ namespace cds { namespace container { iterator insert_with( const K& key, Func func ) { iterator it = insert( key ); - if ( it != end() ) - func( (*it) ); + if ( it != end()) + func( (*it)); return it; } @@ -297,7 +297,7 @@ namespace cds { namespace container { std::pair update( K const& key, bool bAllowInsert = true ) { //TODO: pass arguments by reference (make_pair makes copy) - return base_class::update( std::make_pair( key_type( key ), mapped_type() ), bAllowInsert ); + return base_class::update( std::make_pair( key_type( key ), mapped_type()), bAllowInsert ); } //@cond template @@ -337,7 +337,7 @@ namespace cds { namespace container { iterator contains( K const& key, Less pred ) { CDS_UNUSED( pred ); - return base_class::contains( key, cds::details::predicate_wrapper() ); + return base_class::contains( key, cds::details::predicate_wrapper()); } //@cond template diff --git a/cds/container/split_list_map_rcu.h b/cds/container/split_list_map_rcu.h index acb4675a..9dc68aa8 100644 --- a/cds/container/split_list_map_rcu.h +++ b/cds/container/split_list_map_rcu.h @@ -299,7 +299,7 @@ namespace cds { namespace container { template bool insert( K const& key ) { - return base_class::emplace( key_type( key ), mapped_type() ); + return base_class::emplace( key_type( key ), mapped_type()); } /// Inserts new node @@ -357,7 +357,7 @@ namespace cds { namespace container { bool insert_with( K const& key, Func func ) { //TODO: pass arguments by reference (make_pair makes copy) - return base_class::insert( std::make_pair( key_type( key ), mapped_type() ), func ); + return base_class::insert( std::make_pair( key_type( key ), mapped_type()), func ); } /// For key \p key inserts data of type \p mapped_type created in-place from \p args @@ -409,9 +409,9 @@ namespace cds { namespace container { std::pair update( K const& key, Func func, bool bAllowInsert = true ) { //TODO: pass arguments by reference (make_pair makes copy) - typedef decltype( std::make_pair( key_type( key ), mapped_type() )) arg_pair_type; + typedef decltype( std::make_pair( key_type( key ), mapped_type())) arg_pair_type; - return base_class::update( std::make_pair( key_type( key ), mapped_type() ), + return base_class::update( std::make_pair( key_type( key ), mapped_type()), [&func]( bool bNew, value_type& item, arg_pair_type const& /*val*/ ) { func( bNew, item ); }, @@ -450,7 +450,7 @@ namespace cds { namespace container { bool erase_with( K const& key, Less pred ) { CDS_UNUSED( pred ); - return base_class::erase_with( key, cds::details::predicate_wrapper() ); + return base_class::erase_with( key, cds::details::predicate_wrapper()); } /// Deletes \p key from the map @@ -619,7 +619,7 @@ namespace cds { namespace container { bool contains( K const& key, Less pred ) { CDS_UNUSED( pred ); - return base_class::contains( key, cds::details::predicate_wrapper() ); + return base_class::contains( key, cds::details::predicate_wrapper()); } //@cond template diff --git a/cds/container/split_list_set.h b/cds/container/split_list_set.h index f67609e5..acb24adb 100644 --- a/cds/container/split_list_set.h +++ b/cds/container/split_list_set.h @@ -457,7 +457,7 @@ namespace cds { namespace container { #endif upsert( Q&& val, bool bAllowInsert = true ) { - scoped_node_ptr pNode( alloc_node( val ) ); + scoped_node_ptr pNode( alloc_node( val )); auto bRet = base_class::upsert( *pNode, bAllowInsert ); @@ -535,7 +535,7 @@ namespace cds { namespace container { >::type update( Q const& val, Func func, bool bAllowInsert = true ) { - scoped_node_ptr pNode( alloc_node( val ) ); + scoped_node_ptr pNode( alloc_node( val )); auto bRet = base_class::update( *pNode, [&func]( node_type& item, node_type* old ) { @@ -927,7 +927,7 @@ namespace cds { namespace container { typename std::enable_if< std::is_same::value && is_iterable_list< ordered_list >::value, iterator>::type find_iterator_( Q& val ) { - return iterator( base_class::find( val ) ); + return iterator( base_class::find( val )); } template @@ -943,7 +943,7 @@ namespace cds { namespace container { find_iterator_with_( Q& val, Less pred ) { CDS_UNUSED( pred ); - return iterator( base_class::find_with( val, typename maker::template predicate_wrapper::type() )); + return iterator( base_class::find_with( val, typename maker::template predicate_wrapper::type())); } struct node_disposer { @@ -959,7 +959,7 @@ namespace cds { namespace container { assert( pNode != nullptr ); scoped_node_ptr p( pNode ); - if ( base_class::insert( *pNode ) ) { + if ( base_class::insert( *pNode )) { p.release(); return true; } diff --git a/cds/container/split_list_set_nogc.h b/cds/container/split_list_set_nogc.h index a8cf7f9b..33b85e71 100644 --- a/cds/container/split_list_set_nogc.h +++ b/cds/container/split_list_set_nogc.h @@ -256,7 +256,7 @@ namespace cds { namespace container { */ iterator begin() { - return iterator( base_class::begin() ); + return iterator( base_class::begin()); } /// Returns an iterator that addresses the location succeeding the last element in a set @@ -267,7 +267,7 @@ namespace cds { namespace container { */ iterator end() { - return iterator( base_class::end() ); + return iterator( base_class::end()); } /// Returns a forward const iterator addressing the first element in a set @@ -278,7 +278,7 @@ namespace cds { namespace container { /// Returns a forward const iterator addressing the first element in a set const_iterator cbegin() const { - return const_iterator( base_class::cbegin() ); + return const_iterator( base_class::cbegin()); } /// Returns an const iterator that addresses the location succeeding the last element in a set @@ -289,7 +289,7 @@ namespace cds { namespace container { /// Returns an const iterator that addresses the location succeeding the last element in a set const_iterator cend() const { - return const_iterator( base_class::cend() ); + return const_iterator( base_class::cend()); } //@} @@ -301,7 +301,7 @@ namespace cds { namespace container { scoped_node_ptr p(pNode); iterator it( base_class::insert_( *pNode )); - if ( it != end() ) { + if ( it != end()) { p.release(); return it; } @@ -322,7 +322,7 @@ namespace cds { namespace container { template iterator insert( const Q& val ) { - return insert_node( alloc_node( val ) ); + return insert_node( alloc_node( val )); } /// Inserts data of type \p value_type created from \p args @@ -332,7 +332,7 @@ namespace cds { namespace container { template iterator emplace( Args&&... args ) { - return insert_node( alloc_node( std::forward(args)... ) ); + return insert_node( alloc_node( std::forward(args)... )); } /// Updates the item @@ -407,7 +407,7 @@ namespace cds { namespace container { iterator contains( Q const& key, Less pred ) { CDS_UNUSED( pred ); - return iterator( base_class::find_with_( key, typename maker::template predicate_wrapper::type() )); + return iterator( base_class::find_with_( key, typename maker::template predicate_wrapper::type())); } //@cond // eprecated, use contains() diff --git a/cds/container/split_list_set_rcu.h b/cds/container/split_list_set_rcu.h index 91a9fc7f..49d11e2d 100644 --- a/cds/container/split_list_set_rcu.h +++ b/cds/container/split_list_set_rcu.h @@ -356,7 +356,7 @@ namespace cds { namespace container { assert( pNode != nullptr ); scoped_node_ptr p(pNode); - if ( base_class::insert( *pNode ) ) { + if ( base_class::insert( *pNode )) { p.release(); return true; } @@ -507,7 +507,7 @@ namespace cds { namespace container { */ iterator begin() { - return iterator( base_class::begin() ); + return iterator( base_class::begin()); } /// Returns an iterator that addresses the location succeeding the last element in a set @@ -518,7 +518,7 @@ namespace cds { namespace container { */ iterator end() { - return iterator( base_class::end() ); + return iterator( base_class::end()); } /// Returns a forward const iterator addressing the first element in a set @@ -529,7 +529,7 @@ namespace cds { namespace container { /// Returns a forward const iterator addressing the first element in a set const_iterator cbegin() const { - return const_iterator( base_class::cbegin() ); + return const_iterator( base_class::cbegin()); } /// Returns an const iterator that addresses the location succeeding the last element in a set @@ -540,7 +540,7 @@ namespace cds { namespace container { /// Returns an const iterator that addresses the location succeeding the last element in a set const_iterator cend() const { - return const_iterator( base_class::cend() ); + return const_iterator( base_class::cend()); } //@} @@ -561,7 +561,7 @@ namespace cds { namespace container { template bool insert( Q const& val ) { - return insert_node( alloc_node( val ) ); + return insert_node( alloc_node( val )); } /// Inserts new node @@ -713,7 +713,7 @@ namespace cds { namespace container { bool erase_with( Q const& key, Less pred ) { CDS_UNUSED( pred ); - return base_class::erase_with( key, typename maker::template predicate_wrapper::type() ); + return base_class::erase_with( key, typename maker::template predicate_wrapper::type()); } /// Deletes \p key from the set @@ -797,7 +797,7 @@ namespace cds { namespace container { template exempt_ptr extract( Q const& key ) { - return exempt_ptr( base_class::extract_( key, key_comparator() )); + return exempt_ptr( base_class::extract_( key, key_comparator())); } /// Extracts an item from the set using \p pred predicate for searching @@ -905,7 +905,7 @@ namespace cds { namespace container { bool contains( Q const& key, Less pred ) { CDS_UNUSED( pred ); - return base_class::contains( key, typename maker::template predicate_wrapper::type() ); + return base_class::contains( key, typename maker::template predicate_wrapper::type()); } //@cond template diff --git a/cds/container/striped_map.h b/cds/container/striped_map.h index 7aa03e12..46ecd895 100644 --- a/cds/container/striped_map.h +++ b/cds/container/striped_map.h @@ -339,7 +339,7 @@ namespace cds { namespace container { std::list >::iterator itInsert, std::list >::iterator itWhat ) { - std::pair newVal( itWhat->first, T() ); + std::pair newVal( itWhat->first, T()); std::swap( list.insert( itInsert, newVal )->second, itWhat->second ); } } \endcode @@ -351,7 +351,7 @@ namespace cds { namespace container { std::list >::iterator itInsert, std::list >::iterator itWhat ) { - list.insert( itInsert, std::move( *itWhat ) ); + list.insert( itInsert, std::move( *itWhat )); } } \endcode @@ -378,7 +378,7 @@ namespace cds { namespace container { { std::swap( map.insert( - std::map::value_type( itWhat->first, T() ) ).first->second + std::map::value_type( itWhat->first, T()) ).first->second , itWhat->second )); } @@ -414,7 +414,7 @@ namespace cds { namespace container { bc::slist >::iterator itInsert, bc::slist >::iterator itWhat ) { - std::pair newVal( itWhat->first, T() ); + std::pair newVal( itWhat->first, T()); std::swap( list.insert( itInsert, newVal )->second, itWhat->second ); } } \endcode @@ -426,7 +426,7 @@ namespace cds { namespace container { bc::slist >::iterator itInsert, bc::slist >::iterator itWhat ) { - list.insert_after( itInsert, std::move( *itWhat ) ); + list.insert_after( itInsert, std::move( *itWhat )); } } \endcode @@ -566,7 +566,7 @@ template StripedMap( size_t nCapacity ///< Initial size of bucket table and lock array. Must be power of two, the minimum is 16. ,resizing_policy&& resizingPolicy ///< Resizing policy - ) : base_class( nCapacity, std::forward(resizingPolicy) ) + ) : base_class( nCapacity, std::forward(resizingPolicy)) {} /// Destructor destroys internal data @@ -858,7 +858,7 @@ template bool contains( K const& key, Less pred ) { CDS_UNUSED( pred ); - return base_class::contains( key, cds::details::predicate_wrapper< value_type, Less, key_accessor >() ); + return base_class::contains( key, cds::details::predicate_wrapper< value_type, Less, key_accessor >()); } //@cond template first, typename pair_type::second_type() ); + pair_type newVal( itWhat->first, typename pair_type::second_type()); itInsert = list.insert( itInsert, newVal ); std::swap( itInsert->second, itWhat->second ); } @@ -86,7 +86,7 @@ namespace cds { namespace container { void operator()( list_type& list, iterator itInsert, iterator itWhat ) { - list.insert( itInsert, std::move( *itWhat ) ); + list.insert( itInsert, std::move( *itWhat )); } }; } // namespace striped_set @@ -164,10 +164,10 @@ namespace cds { namespace intrusive { namespace striped_set { template bool insert( const Q& key, Func f ) { - iterator it = std::lower_bound( m_List.begin(), m_List.end(), key, find_predicate() ); + iterator it = std::lower_bound( m_List.begin(), m_List.end(), key, find_predicate()); if ( it == m_List.end() || key_comparator()( key, it->first ) != 0 ) { //value_type newItem( key ); - it = m_List.insert( it, value_type( key_type( key ), mapped_type()) ); + it = m_List.insert( it, value_type( key_type( key ), mapped_type())); f( *it ); return true; @@ -181,7 +181,7 @@ namespace cds { namespace intrusive { namespace striped_set { bool emplace( K&& key, Args&&... args ) { value_type val( key_type( std::forward( key )), mapped_type( std::forward( args )... )); - iterator it = std::lower_bound( m_List.begin(), m_List.end(), val.first, find_predicate() ); + iterator it = std::lower_bound( m_List.begin(), m_List.end(), val.first, find_predicate()); if ( it == m_List.end() || key_comparator()( val.first, it->first ) != 0 ) { m_List.emplace( it, std::move( val )); return true; @@ -192,13 +192,13 @@ namespace cds { namespace intrusive { namespace striped_set { template std::pair update( const Q& key, Func func, bool bAllowInsert ) { - iterator it = std::lower_bound( m_List.begin(), m_List.end(), key, find_predicate() ); + iterator it = std::lower_bound( m_List.begin(), m_List.end(), key, find_predicate()); if ( it == m_List.end() || key_comparator()( key, it->first ) != 0 ) { // insert new if ( !bAllowInsert ) return std::make_pair( false, false ); - it = m_List.insert( it, value_type( key_type( key ), mapped_type() )); + it = m_List.insert( it, value_type( key_type( key ), mapped_type())); func( true, *it ); return std::make_pair( true, true ); @@ -213,7 +213,7 @@ namespace cds { namespace intrusive { namespace striped_set { template bool erase( Q const& key, Func f ) { - iterator it = std::lower_bound( m_List.begin(), m_List.end(), key, find_predicate() ); + iterator it = std::lower_bound( m_List.begin(), m_List.end(), key, find_predicate()); if ( it == m_List.end() || key_comparator()( key, it->first ) != 0 ) return false; @@ -228,7 +228,7 @@ namespace cds { namespace intrusive { namespace striped_set { bool erase( Q const& key, Less pred, Func f ) { iterator it = std::lower_bound( m_List.begin(), m_List.end(), key, pred ); - if ( it == m_List.end() || pred( key, it->first ) || pred(it->first, key) ) + if ( it == m_List.end() || pred( key, it->first ) || pred(it->first, key)) return false; // key exists @@ -241,7 +241,7 @@ namespace cds { namespace intrusive { namespace striped_set { template bool find( Q& val, Func f ) { - iterator it = std::lower_bound( m_List.begin(), m_List.end(), val, find_predicate() ); + iterator it = std::lower_bound( m_List.begin(), m_List.end(), val, find_predicate()); if ( it == m_List.end() || key_comparator()( val, it->first ) != 0 ) return false; @@ -254,7 +254,7 @@ namespace cds { namespace intrusive { namespace striped_set { bool find( Q& val, Less pred, Func f ) { iterator it = std::lower_bound( m_List.begin(), m_List.end(), val, pred ); - if ( it == m_List.end() || pred( val, it->first ) || pred( it->first, val ) ) + if ( it == m_List.end() || pred( val, it->first ) || pred( it->first, val )) return false; // key exists @@ -275,7 +275,7 @@ namespace cds { namespace intrusive { namespace striped_set { void move_item( adapted_container& /*from*/, iterator itWhat ) { - iterator it = std::lower_bound( m_List.begin(), m_List.end(), *itWhat, find_predicate() ); + iterator it = std::lower_bound( m_List.begin(), m_List.end(), *itWhat, find_predicate()); assert( it == m_List.end() || key_comparator()( itWhat->first, it->first ) != 0 ); copy_item()( m_List, it, itWhat ); diff --git a/cds/container/striped_map/boost_slist.h b/cds/container/striped_map/boost_slist.h index 6e938025..904f9000 100644 --- a/cds/container/striped_map/boost_slist.h +++ b/cds/container/striped_map/boost_slist.h @@ -69,7 +69,7 @@ namespace cds { namespace container { void operator()( list_type& list, iterator itInsert, iterator itWhat ) { - pair_type newVal( itWhat->first, typename pair_type::mapped_type() ); + pair_type newVal( itWhat->first, typename pair_type::mapped_type()); itInsert = list.insert_after( itInsert, newVal ); std::swap( itInsert->second, itWhat->second ); } @@ -85,7 +85,7 @@ namespace cds { namespace container { void operator()( list_type& list, iterator itInsert, iterator itWhat ) { - list.insert_after( itInsert, std::move( *itWhat ) ); + list.insert_after( itInsert, std::move( *itWhat )); } }; } // namespace striped_set @@ -178,7 +178,7 @@ namespace cds { namespace intrusive { namespace striped_set { { std::pair< iterator, bool > pos = find_prev_item( key ); if ( !pos.second ) { - pos.first = m_List.insert_after( pos.first, value_type( key_type( key ), mapped_type() )); + pos.first = m_List.insert_after( pos.first, value_type( key_type( key ), mapped_type())); f( *pos.first ); return true; } @@ -207,13 +207,13 @@ namespace cds { namespace intrusive { namespace striped_set { if ( !bAllowInsert ) return std::make_pair( false, false ); - pos.first = m_List.insert_after( pos.first, value_type( key_type( key ), mapped_type() )); + pos.first = m_List.insert_after( pos.first, value_type( key_type( key ), mapped_type())); func( true, *pos.first ); return std::make_pair( true, true ); } else { // already exists - func( false, *(++pos.first) ); + func( false, *(++pos.first)); return std::make_pair( true, false ); } } @@ -227,7 +227,7 @@ namespace cds { namespace intrusive { namespace striped_set { // key exists iterator it = pos.first; - f( *(++it) ); + f( *(++it)); m_List.erase_after( pos.first ); return true; @@ -242,7 +242,7 @@ namespace cds { namespace intrusive { namespace striped_set { // key exists iterator it = pos.first; - f( *(++it) ); + f( *(++it)); m_List.erase_after( pos.first ); return true; diff --git a/cds/container/striped_map/std_hash_map.h b/cds/container/striped_map/std_hash_map.h index 4ab0a8d2..3f07addc 100644 --- a/cds/container/striped_map/std_hash_map.h +++ b/cds/container/striped_map/std_hash_map.h @@ -62,7 +62,7 @@ namespace cds { namespace container { void operator()( map_type& map, iterator itWhat ) { - pair_type pair( itWhat->first, typename pair_type::second_type() ); + pair_type pair( itWhat->first, typename pair_type::second_type()); std::pair res = map.insert( pair ); assert( res.second ); std::swap( res.first->second, itWhat->second ); @@ -79,7 +79,7 @@ namespace cds { namespace container { void operator()( map_type& map, iterator itWhat ) { - map.insert( std::move( *itWhat ) ); + map.insert( std::move( *itWhat )); } }; } // namespace striped_set @@ -132,9 +132,9 @@ namespace cds { namespace intrusive { namespace striped_set { template bool insert( const Q& key, Func f ) { - std::pair res = m_Map.insert( value_type( key_type( key ), mapped_type() )); + std::pair res = m_Map.insert( value_type( key_type( key ), mapped_type())); if ( res.second ) - f( const_cast(*res.first) ); + f( const_cast(*res.first)); return res.second; } @@ -149,13 +149,13 @@ namespace cds { namespace intrusive { namespace striped_set { std::pair update( const Q& key, Func func, bool bAllowInsert ) { if ( bAllowInsert ) { - std::pair res = m_Map.insert( value_type( key_type( key ), mapped_type() ) ); + std::pair res = m_Map.insert( value_type( key_type( key ), mapped_type()) ); func( res.second, const_cast(*res.first)); return std::make_pair( true, res.second ); } else { auto it = m_Map.find( key_type( key )); - if ( it == end() ) + if ( it == end()) return std::make_pair( false, false ); func( false, *it ); return std::make_pair( true, false ); @@ -166,9 +166,9 @@ namespace cds { namespace intrusive { namespace striped_set { bool erase( const Q& key, Func f ) { iterator it = m_Map.find( key_type( key )); - if ( it == m_Map.end() ) + if ( it == m_Map.end()) return false; - f( const_cast(*it) ); + f( const_cast(*it)); m_Map.erase( it ); return true; } @@ -177,7 +177,7 @@ namespace cds { namespace intrusive { namespace striped_set { bool find( Q& key, Func f ) { iterator it = m_Map.find( key_type( key )); - if ( it == m_Map.end() ) + if ( it == m_Map.end()) return false; f( const_cast(*it), key ); return true; @@ -195,7 +195,7 @@ namespace cds { namespace intrusive { namespace striped_set { void move_item( adapted_container& /*from*/, iterator itWhat ) { - assert( m_Map.find( itWhat->first ) == m_Map.end() ); + assert( m_Map.find( itWhat->first ) == m_Map.end()); copy_item()( m_Map, itWhat ); } diff --git a/cds/container/striped_map/std_list.h b/cds/container/striped_map/std_list.h index 2d658e0f..10e6a064 100644 --- a/cds/container/striped_map/std_list.h +++ b/cds/container/striped_map/std_list.h @@ -70,7 +70,7 @@ namespace cds { namespace container { void operator()( list_type& list, iterator itInsert, iterator itWhat ) { - pair_type newVal( itWhat->first, typename pair_type::second_type() ); + pair_type newVal( itWhat->first, typename pair_type::second_type()); itInsert = list.insert( itInsert, newVal ); std::swap( itInsert->second, itWhat->second ); } @@ -86,7 +86,7 @@ namespace cds { namespace container { void operator()( list_type& list, iterator itInsert, iterator itWhat ) { - list.insert( itInsert, std::move( *itWhat ) ); + list.insert( itInsert, std::move( *itWhat )); } }; } // namespace striped_set @@ -175,9 +175,9 @@ namespace cds { namespace intrusive { namespace striped_set { template bool insert( const Q& key, Func f ) { - iterator it = std::lower_bound( m_List.begin(), m_List.end(), key, find_predicate() ); + iterator it = std::lower_bound( m_List.begin(), m_List.end(), key, find_predicate()); if ( it == m_List.end() || key_comparator()( key, it->first ) != 0 ) { - it = m_List.insert( it, value_type( key_type( key ), mapped_type()) ); + it = m_List.insert( it, value_type( key_type( key ), mapped_type())); f( *it ); # if !defined(CDS_STD_LIST_SIZE_CXX11_CONFORM) @@ -194,7 +194,7 @@ namespace cds { namespace intrusive { namespace striped_set { bool emplace( K&& key, Args&&... args ) { value_type val( key_type( std::forward( key )), mapped_type( std::forward( args )... )); - iterator it = std::lower_bound( m_List.begin(), m_List.end(), val.first, find_predicate() ); + iterator it = std::lower_bound( m_List.begin(), m_List.end(), val.first, find_predicate()); if ( it == m_List.end() || key_comparator()( val.first, it->first ) != 0 ) { it = m_List.emplace( it, std::move( val )); @@ -209,13 +209,13 @@ namespace cds { namespace intrusive { namespace striped_set { template std::pair update( const Q& key, Func func, bool bAllowInsert ) { - iterator it = std::lower_bound( m_List.begin(), m_List.end(), key, find_predicate() ); + iterator it = std::lower_bound( m_List.begin(), m_List.end(), key, find_predicate()); if ( it == m_List.end() || key_comparator()( key, it->first ) != 0 ) { // insert new if ( !bAllowInsert ) return std::make_pair( false, false ); - it = m_List.insert( it, value_type( key_type( key ), mapped_type() )); + it = m_List.insert( it, value_type( key_type( key ), mapped_type())); func( true, *it ); # if !defined(CDS_STD_LIST_SIZE_CXX11_CONFORM) ++m_nSize; @@ -232,7 +232,7 @@ namespace cds { namespace intrusive { namespace striped_set { template bool erase( Q const& key, Func f ) { - iterator it = std::lower_bound( m_List.begin(), m_List.end(), key, find_predicate() ); + iterator it = std::lower_bound( m_List.begin(), m_List.end(), key, find_predicate()); if ( it == m_List.end() || key_comparator()( key, it->first ) != 0 ) return false; @@ -250,7 +250,7 @@ namespace cds { namespace intrusive { namespace striped_set { bool erase( Q const& key, Less pred, Func f ) { iterator it = std::lower_bound( m_List.begin(), m_List.end(), key, pred ); - if ( it == m_List.end() || pred( key, it->first ) || pred( it->first, key ) ) + if ( it == m_List.end() || pred( key, it->first ) || pred( it->first, key )) return false; // key exists @@ -266,7 +266,7 @@ namespace cds { namespace intrusive { namespace striped_set { template bool find( Q& val, Func f ) { - iterator it = std::lower_bound( m_List.begin(), m_List.end(), val, find_predicate() ); + iterator it = std::lower_bound( m_List.begin(), m_List.end(), val, find_predicate()); if ( it == m_List.end() || key_comparator()( val, it->first ) != 0 ) return false; @@ -279,7 +279,7 @@ namespace cds { namespace intrusive { namespace striped_set { bool find( Q& val, Less pred, Func f ) { iterator it = std::lower_bound( m_List.begin(), m_List.end(), val, pred ); - if ( it == m_List.end() || pred( val, it->first ) || pred( it->first, val ) ) + if ( it == m_List.end() || pred( val, it->first ) || pred( it->first, val )) return false; // key exists @@ -299,7 +299,7 @@ namespace cds { namespace intrusive { namespace striped_set { void move_item( adapted_container& /*from*/, iterator itWhat ) { - iterator it = std::lower_bound( m_List.begin(), m_List.end(), *itWhat, find_predicate() ); + iterator it = std::lower_bound( m_List.begin(), m_List.end(), *itWhat, find_predicate()); assert( it == m_List.end() || key_comparator()( itWhat->first, it->first ) != 0 ); copy_item()( m_List, it, itWhat ); diff --git a/cds/container/striped_map/std_map.h b/cds/container/striped_map/std_map.h index b1693c88..9eeca8c0 100644 --- a/cds/container/striped_map/std_map.h +++ b/cds/container/striped_map/std_map.h @@ -62,7 +62,7 @@ namespace cds { namespace container { void operator()( map_type& map, iterator itWhat ) { - std::pair< typename map_type::iterator, bool > ret = map.insert( pair_type( itWhat->first, typename pair_type::second_type() )); + std::pair< typename map_type::iterator, bool > ret = map.insert( pair_type( itWhat->first, typename pair_type::second_type())); assert( ret.second ) ; // successful insertion std::swap( ret.first->second, itWhat->second ); } @@ -78,7 +78,7 @@ namespace cds { namespace container { void operator()( map_type& map, iterator itWhat ) { - map.insert( std::move( *itWhat ) ); + map.insert( std::move( *itWhat )); } }; } // namespace striped_set @@ -132,7 +132,7 @@ namespace cds { namespace intrusive { namespace striped_set { template bool insert( const Q& key, Func f ) { - std::pair res = m_Map.insert( value_type( key_type( key ), mapped_type() ) ); + std::pair res = m_Map.insert( value_type( key_type( key ), mapped_type()) ); if ( res.second ) f( *res.first ); return res.second; @@ -149,13 +149,13 @@ namespace cds { namespace intrusive { namespace striped_set { std::pair update( const Q& key, Func func, bool bAllowInsert ) { if ( bAllowInsert ) { - std::pair res = m_Map.insert( value_type( key_type( key ), mapped_type() )); + std::pair res = m_Map.insert( value_type( key_type( key ), mapped_type())); func( res.second, *res.first ); return std::make_pair( true, res.second ); } else { auto it = m_Map.find( key_type( key )); - if ( it == end() ) + if ( it == end()) return std::make_pair( false, false ); func( false, *it ); return std::make_pair( true, false ); @@ -166,7 +166,7 @@ namespace cds { namespace intrusive { namespace striped_set { bool erase( const Q& key, Func f ) { iterator it = m_Map.find( key_type( key )); - if ( it == m_Map.end() ) + if ( it == m_Map.end()) return false; f( *it ); m_Map.erase( it ); @@ -177,7 +177,7 @@ namespace cds { namespace intrusive { namespace striped_set { bool find( Q& key, Func f ) { iterator it = m_Map.find( key_type( key )); - if ( it == m_Map.end() ) + if ( it == m_Map.end()) return false; f( *it, key ); return true; @@ -196,7 +196,7 @@ namespace cds { namespace intrusive { namespace striped_set { void move_item( adapted_container& /*from*/, iterator itWhat ) { - assert( m_Map.find( itWhat->first ) == m_Map.end() ); + assert( m_Map.find( itWhat->first ) == m_Map.end()); copy_item()( m_Map, itWhat ); } diff --git a/cds/container/striped_set.h b/cds/container/striped_set.h index 977c2833..87f33878 100644 --- a/cds/container/striped_set.h +++ b/cds/container/striped_set.h @@ -351,7 +351,7 @@ namespace cds { namespace container { struct swap_item { void operator()( std::list& list, std::list::iterator itInsert, std::list::iterator itWhat ) { - std::swap( *list.insert( itInsert, T() ), *itWhat ); + std::swap( *list.insert( itInsert, T()), *itWhat ); } } \endcode @@ -359,7 +359,7 @@ namespace cds { namespace container { struct move_item { void operator()( std::list& list, std::list::iterator itInsert, std::list::iterator itWhat ) { - list.insert( itInsert, std::move( *itWhat ) ); + list.insert( itInsert, std::move( *itWhat )); } } \endcode @@ -403,7 +403,7 @@ namespace cds { namespace container { struct swap_item { void operator()( bc::slist& list, bc::slist::iterator itInsert, bc::slist::iterator itWhat ) { - std::swap( *list.insert_after( itInsert, T() ), *itWhat ); + std::swap( *list.insert_after( itInsert, T()), *itWhat ); } } \endcode @@ -411,7 +411,7 @@ namespace cds { namespace container { struct move_item { void operator()( bc::slist& list, bc::slist::iterator itInsert, bc::slist::iterator itWhat ) { - list.insert_after( itInsert, std::move( *itWhat ) ); + list.insert_after( itInsert, std::move( *itWhat )); } } \endcode @@ -553,7 +553,7 @@ namespace cds { namespace container { ,resizing_policy&& resizingPolicy ///< Resizing policy ) - : base_class( nCapacity, std::forward(resizingPolicy) ) + : base_class( nCapacity, std::forward(resizingPolicy)) {} /// Destructor destroys internal data diff --git a/cds/container/striped_set/adapter.h b/cds/container/striped_set/adapter.h index dd2c1308..26faff5b 100644 --- a/cds/container/striped_set/adapter.h +++ b/cds/container/striped_set/adapter.h @@ -260,7 +260,7 @@ namespace cds { namespace container { void operator()( set_type& set, iterator itWhat ) { - set.insert( std::move( *itWhat ) ); + set.insert( std::move( *itWhat )); } }; }; @@ -306,9 +306,9 @@ namespace cds { namespace container { template bool insert( const Q& val, Func f ) { - std::pair res = m_Set.insert( value_type(val) ); + std::pair res = m_Set.insert( value_type(val)); if ( res.second ) - f( const_cast(*res.first) ); + f( const_cast(*res.first)); return res.second; } @@ -323,13 +323,13 @@ namespace cds { namespace container { std::pair update( const Q& val, Func func, bool bAllowInsert ) { if ( bAllowInsert ) { - std::pair res = m_Set.insert( value_type(val) ); + std::pair res = m_Set.insert( value_type(val)); func( res.second, const_cast(*res.first), val ); return std::make_pair( true, res.second ); } else { auto it = m_Set.find( value_type( val )); - if ( it == m_Set.end() ) + if ( it == m_Set.end()) return std::make_pair( false, false ); func( false, const_cast(*it), val ); return std::make_pair( true, false ); @@ -339,10 +339,10 @@ namespace cds { namespace container { template bool erase( const Q& key, Func f ) { - const_iterator it = m_Set.find( value_type(key) ); - if ( it == m_Set.end() ) + const_iterator it = m_Set.find( value_type(key)); + if ( it == m_Set.end()) return false; - f( const_cast(*it) ); + f( const_cast(*it)); m_Set.erase( it ); return true; } @@ -350,8 +350,8 @@ namespace cds { namespace container { template bool find( Q& val, Func f ) { - iterator it = m_Set.find( value_type(val) ); - if ( it == m_Set.end() ) + iterator it = m_Set.find( value_type(val)); + if ( it == m_Set.end()) return false; f( const_cast(*it), val ); return true; @@ -369,7 +369,7 @@ namespace cds { namespace container { void move_item( adapted_container& /*from*/, iterator itWhat ) { - assert( m_Set.find( *itWhat ) == m_Set.end() ); + assert( m_Set.find( *itWhat ) == m_Set.end()); copy_item()( m_Set, itWhat ); } @@ -399,7 +399,7 @@ namespace cds { namespace container { void operator()( map_type& map, iterator itWhat ) { - std::pair< iterator, bool > ret = map.insert( pair_type( itWhat->first, typename pair_type::second_type() )); + std::pair< iterator, bool > ret = map.insert( pair_type( itWhat->first, typename pair_type::second_type())); assert( ret.second ) ; // successful insertion std::swap( ret.first->second, itWhat->second ); } @@ -412,7 +412,7 @@ namespace cds { namespace container { void operator()( map_type& map, iterator itWhat ) { - map.insert( std::move( *itWhat ) ); + map.insert( std::move( *itWhat )); } }; }; @@ -452,7 +452,7 @@ namespace cds { namespace container { template bool insert( const Q& key, Func f ) { - std::pair res = m_Map.insert( value_type( key_type( key ), mapped_type() ) ); + std::pair res = m_Map.insert( value_type( key_type( key ), mapped_type()) ); if ( res.second ) f( *res.first ); return res.second; @@ -469,13 +469,13 @@ namespace cds { namespace container { std::pair update( const Q& key, Func func, bool bAllowInsert ) { if ( bAllowInsert ) { - std::pair res = m_Map.insert( value_type( key_type( key ), mapped_type() )); + std::pair res = m_Map.insert( value_type( key_type( key ), mapped_type())); func( res.second, *res.first ); return std::make_pair( true, res.second ); } else { auto it = m_Map.find( key_type( key )); - if ( it == end() ) + if ( it == end()) return std::make_pair( false, false ); func( false, *it ); return std::make_pair( true, false ); @@ -486,7 +486,7 @@ namespace cds { namespace container { bool erase( const Q& key, Func f ) { iterator it = m_Map.find( key_type( key )); - if ( it == m_Map.end() ) + if ( it == m_Map.end()) return false; f( *it ); m_Map.erase( it ); @@ -497,7 +497,7 @@ namespace cds { namespace container { bool find( Q& val, Func f ) { iterator it = m_Map.find( key_type( val )); - if ( it == m_Map.end() ) + if ( it == m_Map.end()) return false; f( *it, val ); return true; @@ -515,7 +515,7 @@ namespace cds { namespace container { void move_item( adapted_container& /*from*/, iterator itWhat ) { - assert( m_Map.find( itWhat->first ) == m_Map.end() ); + assert( m_Map.find( itWhat->first ) == m_Map.end()); copy_item()( m_Map, itWhat ); } diff --git a/cds/container/striped_set/boost_list.h b/cds/container/striped_set/boost_list.h index dd49b2ec..3647c88f 100644 --- a/cds/container/striped_set/boost_list.h +++ b/cds/container/striped_set/boost_list.h @@ -82,7 +82,7 @@ namespace cds { namespace container { void operator()( list_type& list, iterator itInsert, iterator itWhat ) { - list.insert( itInsert, std::move( *itWhat ) ); + list.insert( itInsert, std::move( *itWhat )); } }; } // namespace striped_set @@ -158,7 +158,7 @@ namespace cds { namespace intrusive { namespace striped_set { template bool insert( Q const& val, Func f ) { - iterator it = std::lower_bound( m_List.begin(), m_List.end(), val, find_predicate() ); + iterator it = std::lower_bound( m_List.begin(), m_List.end(), val, find_predicate()); if ( it == m_List.end() || key_comparator()( val, *it ) != 0 ) { value_type newItem( val ); it = m_List.insert( it, newItem ); @@ -175,9 +175,9 @@ namespace cds { namespace intrusive { namespace striped_set { bool emplace( Args&&... args ) { value_type val( std::forward(args)... ); - iterator it = std::lower_bound( m_List.begin(), m_List.end(), val, find_predicate() ); + iterator it = std::lower_bound( m_List.begin(), m_List.end(), val, find_predicate()); if ( it == m_List.end() || key_comparator()( val, *it ) != 0 ) { - m_List.emplace( it, std::move( val ) ); + m_List.emplace( it, std::move( val )); return true; } return false; @@ -186,7 +186,7 @@ namespace cds { namespace intrusive { namespace striped_set { template std::pair update( Q const& val, Func func, bool bAllowInsert ) { - iterator it = std::lower_bound( m_List.begin(), m_List.end(), val, find_predicate() ); + iterator it = std::lower_bound( m_List.begin(), m_List.end(), val, find_predicate()); if ( it == m_List.end() || key_comparator()( val, *it ) != 0 ) { // insert new if ( !bAllowInsert ) @@ -207,7 +207,7 @@ namespace cds { namespace intrusive { namespace striped_set { template bool erase( Q const& key, Func f ) { - iterator it = std::lower_bound( m_List.begin(), m_List.end(), key, find_predicate() ); + iterator it = std::lower_bound( m_List.begin(), m_List.end(), key, find_predicate()); if ( it == m_List.end() || key_comparator()( key, *it ) != 0 ) return false; @@ -222,7 +222,7 @@ namespace cds { namespace intrusive { namespace striped_set { bool erase( Q const& key, Less pred, Func f ) { iterator it = std::lower_bound( m_List.begin(), m_List.end(), key, pred ); - if ( it == m_List.end() || pred( key, *it ) || pred( *it, key ) ) + if ( it == m_List.end() || pred( key, *it ) || pred( *it, key )) return false; // key exists @@ -235,7 +235,7 @@ namespace cds { namespace intrusive { namespace striped_set { template bool find( Q& val, Func f ) { - iterator it = std::lower_bound( m_List.begin(), m_List.end(), val, find_predicate() ); + iterator it = std::lower_bound( m_List.begin(), m_List.end(), val, find_predicate()); if ( it == m_List.end() || key_comparator()( val, *it ) != 0 ) return false; @@ -248,7 +248,7 @@ namespace cds { namespace intrusive { namespace striped_set { bool find( Q& val, Less pred, Func f ) { iterator it = std::lower_bound( m_List.begin(), m_List.end(), val, pred ); - if ( it == m_List.end() || pred( val, *it ) || pred( *it, val ) ) + if ( it == m_List.end() || pred( val, *it ) || pred( *it, val )) return false; // key exists @@ -269,7 +269,7 @@ namespace cds { namespace intrusive { namespace striped_set { void move_item( adapted_container& /*from*/, iterator itWhat ) { - iterator it = std::lower_bound( m_List.begin(), m_List.end(), *itWhat, find_predicate() ); + iterator it = std::lower_bound( m_List.begin(), m_List.end(), *itWhat, find_predicate()); assert( it == m_List.end() || key_comparator()( *itWhat, *it ) != 0 ); copy_item()( m_List, it, itWhat ); diff --git a/cds/container/striped_set/boost_slist.h b/cds/container/striped_set/boost_slist.h index 04c0ba23..9da3702e 100644 --- a/cds/container/striped_set/boost_slist.h +++ b/cds/container/striped_set/boost_slist.h @@ -76,7 +76,7 @@ namespace cds { namespace container { void operator()( list_type& list, iterator itInsert, iterator itWhat ) { - list.insert_after( itInsert, std::move( *itWhat ) ); + list.insert_after( itInsert, std::move( *itWhat )); } }; @@ -145,7 +145,7 @@ namespace cds { namespace intrusive { namespace striped_set { for ( iterator it = m_List.begin(); it != itEnd; ++it ) { if ( pred( key, *it )) itPrev = it; - else if ( pred( *it, key ) ) + else if ( pred( *it, key )) break; else return std::make_pair( itPrev, true ); @@ -185,7 +185,7 @@ namespace cds { namespace intrusive { namespace striped_set { value_type val( std::forward(args)... ); std::pair< iterator, bool > pos = find_prev_item( val ); if ( !pos.second ) { - m_List.emplace_after( pos.first, std::move( val ) ); + m_List.emplace_after( pos.first, std::move( val )); return true; } return false; @@ -221,7 +221,7 @@ namespace cds { namespace intrusive { namespace striped_set { // key exists iterator it = pos.first; - f( *(++it) ); + f( *(++it)); m_List.erase_after( pos.first ); return true; @@ -236,7 +236,7 @@ namespace cds { namespace intrusive { namespace striped_set { // key exists iterator it = pos.first; - f( *(++it) ); + f( *(++it)); m_List.erase_after( pos.first ); return true; diff --git a/cds/container/striped_set/boost_stable_vector.h b/cds/container/striped_set/boost_stable_vector.h index a5201c2c..b83508b5 100644 --- a/cds/container/striped_set/boost_stable_vector.h +++ b/cds/container/striped_set/boost_stable_vector.h @@ -156,7 +156,7 @@ namespace cds { namespace intrusive { namespace striped_set { template bool insert( const Q& val, Func f ) { - iterator it = std::lower_bound( m_Vector.begin(), m_Vector.end(), val, find_predicate() ); + iterator it = std::lower_bound( m_Vector.begin(), m_Vector.end(), val, find_predicate()); if ( it == m_Vector.end() || key_comparator()( val, *it ) != 0 ) { value_type newItem( val ); it = m_Vector.insert( it, newItem ); @@ -170,9 +170,9 @@ namespace cds { namespace intrusive { namespace striped_set { bool emplace( Args&&... args ) { value_type val( std::forward(args)... ); - iterator it = std::lower_bound( m_Vector.begin(), m_Vector.end(), val, find_predicate() ); + iterator it = std::lower_bound( m_Vector.begin(), m_Vector.end(), val, find_predicate()); if ( it == m_Vector.end() || key_comparator()( val, *it ) != 0 ) { - it = m_Vector.emplace( it, std::move( val ) ); + it = m_Vector.emplace( it, std::move( val )); return true; } return false; @@ -181,7 +181,7 @@ namespace cds { namespace intrusive { namespace striped_set { template std::pair update( const Q& val, Func func, bool bAllowInsert ) { - iterator it = std::lower_bound( m_Vector.begin(), m_Vector.end(), val, find_predicate() ); + iterator it = std::lower_bound( m_Vector.begin(), m_Vector.end(), val, find_predicate()); if ( it == m_Vector.end() || key_comparator()( val, *it ) != 0 ) { // insert new if ( !bAllowInsert ) @@ -202,7 +202,7 @@ namespace cds { namespace intrusive { namespace striped_set { template bool erase( const Q& key, Func f ) { - iterator it = std::lower_bound( m_Vector.begin(), m_Vector.end(), key, find_predicate() ); + iterator it = std::lower_bound( m_Vector.begin(), m_Vector.end(), key, find_predicate()); if ( it == m_Vector.end() || key_comparator()( key, *it ) != 0 ) return false; @@ -216,7 +216,7 @@ namespace cds { namespace intrusive { namespace striped_set { bool erase( const Q& key, Less pred, Func f ) { iterator it = std::lower_bound( m_Vector.begin(), m_Vector.end(), key, pred ); - if ( it == m_Vector.end() || pred( key, *it ) || pred( *it, key ) ) + if ( it == m_Vector.end() || pred( key, *it ) || pred( *it, key )) return false; // key exists @@ -228,7 +228,7 @@ namespace cds { namespace intrusive { namespace striped_set { template bool find( Q& val, Func f ) { - iterator it = std::lower_bound( m_Vector.begin(), m_Vector.end(), val, find_predicate() ); + iterator it = std::lower_bound( m_Vector.begin(), m_Vector.end(), val, find_predicate()); if ( it == m_Vector.end() || key_comparator()( val, *it ) != 0 ) return false; @@ -241,7 +241,7 @@ namespace cds { namespace intrusive { namespace striped_set { bool find( Q& val, Less pred, Func f ) { iterator it = std::lower_bound( m_Vector.begin(), m_Vector.end(), val, pred ); - if ( it == m_Vector.end() || pred( val, *it ) || pred( *it, val ) ) + if ( it == m_Vector.end() || pred( val, *it ) || pred( *it, val )) return false; // key exists @@ -262,7 +262,7 @@ namespace cds { namespace intrusive { namespace striped_set { void move_item( adapted_container& /*from*/, iterator itWhat ) { - iterator it = std::lower_bound( m_Vector.begin(), m_Vector.end(), *itWhat, find_predicate() ); + iterator it = std::lower_bound( m_Vector.begin(), m_Vector.end(), *itWhat, find_predicate()); assert( it == m_Vector.end() || key_comparator()( *itWhat, *it ) != 0 ); copy_item()( m_Vector, it, itWhat ); diff --git a/cds/container/striped_set/boost_vector.h b/cds/container/striped_set/boost_vector.h index 21a6d32e..94927d9f 100644 --- a/cds/container/striped_set/boost_vector.h +++ b/cds/container/striped_set/boost_vector.h @@ -156,7 +156,7 @@ namespace cds { namespace intrusive { namespace striped_set { template bool insert( const Q& val, Func f ) { - iterator it = std::lower_bound( m_Vector.begin(), m_Vector.end(), val, find_predicate() ); + iterator it = std::lower_bound( m_Vector.begin(), m_Vector.end(), val, find_predicate()); if ( it == m_Vector.end() || key_comparator()( val, *it ) != 0 ) { value_type newItem( val ); it = m_Vector.insert( it, newItem ); @@ -170,9 +170,9 @@ namespace cds { namespace intrusive { namespace striped_set { bool emplace( Args&&... args ) { value_type val( std::forward(args)... ); - iterator it = std::lower_bound( m_Vector.begin(), m_Vector.end(), val, find_predicate() ); + iterator it = std::lower_bound( m_Vector.begin(), m_Vector.end(), val, find_predicate()); if ( it == m_Vector.end() || key_comparator()( val, *it ) != 0 ) { - it = m_Vector.emplace( it, std::move( val ) ); + it = m_Vector.emplace( it, std::move( val )); return true; } return false; @@ -181,7 +181,7 @@ namespace cds { namespace intrusive { namespace striped_set { template std::pair update( const Q& val, Func func, bool bAllowInsert ) { - iterator it = std::lower_bound( m_Vector.begin(), m_Vector.end(), val, find_predicate() ); + iterator it = std::lower_bound( m_Vector.begin(), m_Vector.end(), val, find_predicate()); if ( it == m_Vector.end() || key_comparator()( val, *it ) != 0 ) { // insert new if ( !bAllowInsert ) @@ -202,7 +202,7 @@ namespace cds { namespace intrusive { namespace striped_set { template bool erase( const Q& key, Func f ) { - iterator it = std::lower_bound( m_Vector.begin(), m_Vector.end(), key, find_predicate() ); + iterator it = std::lower_bound( m_Vector.begin(), m_Vector.end(), key, find_predicate()); if ( it == m_Vector.end() || key_comparator()( key, *it ) != 0 ) return false; @@ -216,7 +216,7 @@ namespace cds { namespace intrusive { namespace striped_set { bool erase( Q const& key, Less pred, Func f ) { iterator it = std::lower_bound( m_Vector.begin(), m_Vector.end(), key, pred ); - if ( it == m_Vector.end() || pred( key, *it ) || pred( *it, key ) ) + if ( it == m_Vector.end() || pred( key, *it ) || pred( *it, key )) return false; // key exists @@ -228,7 +228,7 @@ namespace cds { namespace intrusive { namespace striped_set { template bool find( Q& val, Func f ) { - iterator it = std::lower_bound( m_Vector.begin(), m_Vector.end(), val, find_predicate() ); + iterator it = std::lower_bound( m_Vector.begin(), m_Vector.end(), val, find_predicate()); if ( it == m_Vector.end() || key_comparator()( val, *it ) != 0 ) return false; @@ -241,7 +241,7 @@ namespace cds { namespace intrusive { namespace striped_set { bool find( Q& val, Less pred, Func f ) { iterator it = std::lower_bound( m_Vector.begin(), m_Vector.end(), val, pred ); - if ( it == m_Vector.end() || pred( val, *it ) || pred( *it, val ) ) + if ( it == m_Vector.end() || pred( val, *it ) || pred( *it, val )) return false; // key exists @@ -262,7 +262,7 @@ namespace cds { namespace intrusive { namespace striped_set { void move_item( adapted_container& /*from*/, iterator itWhat ) { - iterator it = std::lower_bound( m_Vector.begin(), m_Vector.end(), *itWhat, find_predicate() ); + iterator it = std::lower_bound( m_Vector.begin(), m_Vector.end(), *itWhat, find_predicate()); assert( it == m_Vector.end() || key_comparator()( *itWhat, *it ) != 0 ); copy_item()( m_Vector, it, itWhat ); diff --git a/cds/container/striped_set/std_hash_set.h b/cds/container/striped_set/std_hash_set.h index 14c300d6..ca3342eb 100644 --- a/cds/container/striped_set/std_hash_set.h +++ b/cds/container/striped_set/std_hash_set.h @@ -64,7 +64,7 @@ namespace cds { namespace container { void operator()( set_type& set, iterator itWhat ) { - set.insert( std::move( *itWhat ) ); + set.insert( std::move( *itWhat )); } }; @@ -115,9 +115,9 @@ namespace cds { namespace intrusive { namespace striped_set { template bool insert( const Q& val, Func f ) { - std::pair res = m_Set.insert( value_type(val) ); + std::pair res = m_Set.insert( value_type(val)); if ( res.second ) - f( const_cast(*res.first) ); + f( const_cast(*res.first)); return res.second; } @@ -132,13 +132,13 @@ namespace cds { namespace intrusive { namespace striped_set { std::pair update( const Q& val, Func func, bool bAllowInsert ) { if ( bAllowInsert ) { - std::pair res = m_Set.insert( value_type(val) ); + std::pair res = m_Set.insert( value_type(val)); func( res.second, const_cast(*res.first), val ); return std::make_pair( true, res.second ); } else { auto it = m_Set.find( value_type(val)); - if ( it == m_Set.end() ) + if ( it == m_Set.end()) return std::make_pair( false, false ); func( false, const_cast(*it), val ); @@ -149,10 +149,10 @@ namespace cds { namespace intrusive { namespace striped_set { template bool erase( const Q& key, Func f ) { - const_iterator it = m_Set.find( value_type(key) ); - if ( it == m_Set.end() ) + const_iterator it = m_Set.find( value_type(key)); + if ( it == m_Set.end()) return false; - f( const_cast(*it) ); + f( const_cast(*it)); m_Set.erase( it ); return true; } @@ -160,8 +160,8 @@ namespace cds { namespace intrusive { namespace striped_set { template bool find( Q& val, Func f ) { - iterator it = m_Set.find( value_type(val) ); - if ( it == m_Set.end() ) + iterator it = m_Set.find( value_type(val)); + if ( it == m_Set.end()) return false; f( const_cast(*it), val ); return true; @@ -180,7 +180,7 @@ namespace cds { namespace intrusive { namespace striped_set { void move_item( adapted_container& /*from*/, iterator itWhat ) { - assert( m_Set.find( *itWhat ) == m_Set.end() ); + assert( m_Set.find( *itWhat ) == m_Set.end()); copy_item()( m_Set, itWhat ); } diff --git a/cds/container/striped_set/std_list.h b/cds/container/striped_set/std_list.h index 93b9fa0e..491f6fc0 100644 --- a/cds/container/striped_set/std_list.h +++ b/cds/container/striped_set/std_list.h @@ -82,7 +82,7 @@ namespace cds { namespace container { void operator()( list_type& list, iterator itInsert, iterator itWhat ) { - list.insert( itInsert, std::move( *itWhat ) ); + list.insert( itInsert, std::move( *itWhat )); } }; } // namespace striped_set @@ -169,7 +169,7 @@ namespace cds { namespace intrusive { namespace striped_set { template bool insert( const Q& val, Func f ) { - iterator it = std::lower_bound( m_List.begin(), m_List.end(), val, find_predicate() ); + iterator it = std::lower_bound( m_List.begin(), m_List.end(), val, find_predicate()); if ( it == m_List.end() || key_comparator()( val, *it ) != 0 ) { value_type newItem( val ); it = m_List.insert( it, newItem ); @@ -189,9 +189,9 @@ namespace cds { namespace intrusive { namespace striped_set { bool emplace( Args&&... args ) { value_type val(std::forward(args)...); - iterator it = std::lower_bound( m_List.begin(), m_List.end(), val, find_predicate() ); + iterator it = std::lower_bound( m_List.begin(), m_List.end(), val, find_predicate()); if ( it == m_List.end() || key_comparator()( val, *it ) != 0 ) { - it = m_List.emplace( it, std::move( val ) ); + it = m_List.emplace( it, std::move( val )); # if !defined(CDS_STD_LIST_SIZE_CXX11_CONFORM) ++m_nSize; # endif @@ -203,7 +203,7 @@ namespace cds { namespace intrusive { namespace striped_set { template std::pair update( const Q& val, Func func, bool bAllowInsert ) { - iterator it = std::lower_bound( m_List.begin(), m_List.end(), val, find_predicate() ); + iterator it = std::lower_bound( m_List.begin(), m_List.end(), val, find_predicate()); if ( it == m_List.end() || key_comparator()( val, *it ) != 0 ) { // insert new if ( !bAllowInsert ) @@ -227,7 +227,7 @@ namespace cds { namespace intrusive { namespace striped_set { template bool erase( const Q& key, Func f ) { - iterator it = std::lower_bound( m_List.begin(), m_List.end(), key, find_predicate() ); + iterator it = std::lower_bound( m_List.begin(), m_List.end(), key, find_predicate()); if ( it == m_List.end() || key_comparator()( key, *it ) != 0 ) return false; @@ -245,7 +245,7 @@ namespace cds { namespace intrusive { namespace striped_set { bool erase( Q const& key, Less pred, Func f ) { iterator it = std::lower_bound( m_List.begin(), m_List.end(), key, pred ); - if ( it == m_List.end() || pred( key, *it ) || pred( *it, key ) ) + if ( it == m_List.end() || pred( key, *it ) || pred( *it, key )) return false; // key exists @@ -261,7 +261,7 @@ namespace cds { namespace intrusive { namespace striped_set { template bool find( Q& val, Func f ) { - iterator it = std::lower_bound( m_List.begin(), m_List.end(), val, find_predicate() ); + iterator it = std::lower_bound( m_List.begin(), m_List.end(), val, find_predicate()); if ( it == m_List.end() || key_comparator()( val, *it ) != 0 ) return false; @@ -274,7 +274,7 @@ namespace cds { namespace intrusive { namespace striped_set { bool find( Q& val, Less pred, Func f ) { iterator it = std::lower_bound( m_List.begin(), m_List.end(), val, pred ); - if ( it == m_List.end() || pred( val, *it ) || pred( *it, val ) ) + if ( it == m_List.end() || pred( val, *it ) || pred( *it, val )) return false; // key exists @@ -295,7 +295,7 @@ namespace cds { namespace intrusive { namespace striped_set { void move_item( adapted_container& /*from*/, iterator itWhat ) { - iterator it = std::lower_bound( m_List.begin(), m_List.end(), *itWhat, find_predicate() ); + iterator it = std::lower_bound( m_List.begin(), m_List.end(), *itWhat, find_predicate()); assert( it == m_List.end() || key_comparator()( *itWhat, *it ) != 0 ); copy_item()( m_List, it, itWhat ); diff --git a/cds/container/striped_set/std_set.h b/cds/container/striped_set/std_set.h index 31cb883c..95ace96f 100644 --- a/cds/container/striped_set/std_set.h +++ b/cds/container/striped_set/std_set.h @@ -64,7 +64,7 @@ namespace cds { namespace container { void operator()( set_type& set, iterator itWhat ) { - set.insert( std::move( *itWhat ) ); + set.insert( std::move( *itWhat )); } }; } // namespace striped_set @@ -116,9 +116,9 @@ namespace cds { namespace intrusive { namespace striped_set { template bool insert( const Q& val, Func f ) { - std::pair res = m_Set.insert( value_type(val) ); + std::pair res = m_Set.insert( value_type(val)); if ( res.second ) - f( const_cast(*res.first) ); + f( const_cast(*res.first)); return res.second; } @@ -133,13 +133,13 @@ namespace cds { namespace intrusive { namespace striped_set { std::pair update( const Q& val, Func func, bool bAllowInsert ) { if ( bAllowInsert ) { - std::pair res = m_Set.insert( value_type(val) ); + std::pair res = m_Set.insert( value_type(val)); func( res.second, const_cast(*res.first), val ); return std::make_pair( true, res.second ); } else { auto it = m_Set.find(value_type(val)); - if ( it == m_Set.end() ) + if ( it == m_Set.end()) return std::make_pair( false, false ); func( false, const_cast(*it), val ); return std::make_pair( true, false ); @@ -149,10 +149,10 @@ namespace cds { namespace intrusive { namespace striped_set { template bool erase( const Q& key, Func f ) { - iterator it = m_Set.find( value_type(key) ); - if ( it == m_Set.end() ) + iterator it = m_Set.find( value_type(key)); + if ( it == m_Set.end()) return false; - f( const_cast(*it) ); + f( const_cast(*it)); m_Set.erase( it ); return true; } @@ -160,8 +160,8 @@ namespace cds { namespace intrusive { namespace striped_set { template bool find( Q& val, Func f ) { - iterator it = m_Set.find( value_type(val) ); - if ( it == m_Set.end() ) + iterator it = m_Set.find( value_type(val)); + if ( it == m_Set.end()) return false; f( const_cast(*it), val ); return true; @@ -179,7 +179,7 @@ namespace cds { namespace intrusive { namespace striped_set { void move_item( adapted_container& /*from*/, iterator itWhat ) { - assert( m_Set.find( *itWhat ) == m_Set.end() ); + assert( m_Set.find( *itWhat ) == m_Set.end()); copy_item()( m_Set, itWhat ); } diff --git a/cds/container/striped_set/std_vector.h b/cds/container/striped_set/std_vector.h index 35a886ec..1656088c 100644 --- a/cds/container/striped_set/std_vector.h +++ b/cds/container/striped_set/std_vector.h @@ -153,7 +153,7 @@ namespace cds { namespace intrusive { namespace striped_set { template bool insert( const Q& val, Func f ) { - iterator it = std::lower_bound( m_Vector.begin(), m_Vector.end(), val, find_predicate() ); + iterator it = std::lower_bound( m_Vector.begin(), m_Vector.end(), val, find_predicate()); if ( it == m_Vector.end() || key_comparator()( val, *it ) != 0 ) { value_type newItem( val ); it = m_Vector.insert( it, newItem ); @@ -173,9 +173,9 @@ namespace cds { namespace intrusive { namespace striped_set { #else value_type val( std::forward(args)... ); #endif - iterator it = std::lower_bound( m_Vector.begin(), m_Vector.end(), val, find_predicate() ); + iterator it = std::lower_bound( m_Vector.begin(), m_Vector.end(), val, find_predicate()); if ( it == m_Vector.end() || key_comparator()( val, *it ) != 0 ) { - it = m_Vector.emplace( it, std::move( val ) ); + it = m_Vector.emplace( it, std::move( val )); return true; } return false; @@ -184,7 +184,7 @@ namespace cds { namespace intrusive { namespace striped_set { template std::pair update( const Q& val, Func func, bool bAllowInsert ) { - iterator it = std::lower_bound( m_Vector.begin(), m_Vector.end(), val, find_predicate() ); + iterator it = std::lower_bound( m_Vector.begin(), m_Vector.end(), val, find_predicate()); if ( it == m_Vector.end() || key_comparator()( val, *it ) != 0 ) { // insert new if ( !bAllowInsert ) @@ -205,7 +205,7 @@ namespace cds { namespace intrusive { namespace striped_set { template bool erase( const Q& key, Func f ) { - iterator it = std::lower_bound( m_Vector.begin(), m_Vector.end(), key, find_predicate() ); + iterator it = std::lower_bound( m_Vector.begin(), m_Vector.end(), key, find_predicate()); if ( it == m_Vector.end() || key_comparator()( key, *it ) != 0 ) return false; @@ -219,7 +219,7 @@ namespace cds { namespace intrusive { namespace striped_set { bool erase( const Q& key, Less pred, Func f ) { iterator it = std::lower_bound( m_Vector.begin(), m_Vector.end(), key, pred ); - if ( it == m_Vector.end() || pred( key, *it ) || pred( *it, key ) ) + if ( it == m_Vector.end() || pred( key, *it ) || pred( *it, key )) return false; // key exists @@ -231,7 +231,7 @@ namespace cds { namespace intrusive { namespace striped_set { template bool find( Q& val, Func f ) { - iterator it = std::lower_bound( m_Vector.begin(), m_Vector.end(), val, find_predicate() ); + iterator it = std::lower_bound( m_Vector.begin(), m_Vector.end(), val, find_predicate()); if ( it == m_Vector.end() || key_comparator()( val, *it ) != 0 ) return false; @@ -244,7 +244,7 @@ namespace cds { namespace intrusive { namespace striped_set { bool find( Q& val, Less pred, Func f ) { iterator it = std::lower_bound( m_Vector.begin(), m_Vector.end(), val, pred ); - if ( it == m_Vector.end() || pred( val, *it ) || pred( *it, val ) ) + if ( it == m_Vector.end() || pred( val, *it ) || pred( *it, val )) return false; // key exists @@ -265,7 +265,7 @@ namespace cds { namespace intrusive { namespace striped_set { void move_item( adapted_container& /*from*/, iterator itWhat ) { - iterator it = std::lower_bound( m_Vector.begin(), m_Vector.end(), *itWhat, find_predicate() ); + iterator it = std::lower_bound( m_Vector.begin(), m_Vector.end(), *itWhat, find_predicate()); assert( it == m_Vector.end() || key_comparator()( *itWhat, *it ) != 0 ); copy_item()( m_Vector, it, itWhat ); diff --git a/cds/container/tsigas_cycle_queue.h b/cds/container/tsigas_cycle_queue.h index acf23be5..741b31ba 100644 --- a/cds/container/tsigas_cycle_queue.h +++ b/cds/container/tsigas_cycle_queue.h @@ -290,7 +290,7 @@ namespace cds { namespace container { bool enqueue( value_type&& val ) { scoped_node_ptr p( alloc_node_move( std::move( val ))); - if ( base_class::enqueue( *p ) ) { + if ( base_class::enqueue( *p )) { p.release(); return true; } @@ -310,7 +310,7 @@ namespace cds { namespace container { template bool enqueue_with( Func f ) { - scoped_node_ptr p( alloc_node() ); + scoped_node_ptr p( alloc_node()); f( *p ); if ( base_class::enqueue( *p )) { p.release(); diff --git a/cds/container/vyukov_mpmc_cycle_queue.h b/cds/container/vyukov_mpmc_cycle_queue.h index d8439236..d9365949 100644 --- a/cds/container/vyukov_mpmc_cycle_queue.h +++ b/cds/container/vyukov_mpmc_cycle_queue.h @@ -282,7 +282,7 @@ namespace cds { namespace container { } else if (dif < 0) { // Queue full? - if ( pos - m_posDequeue.load( memory_model::memory_order_relaxed ) == capacity() ) + if ( pos - m_posDequeue.load( memory_model::memory_order_relaxed ) == capacity()) return false; // queue full bkoff(); pos = m_posEnqueue.load( memory_model::memory_order_relaxed ); @@ -483,7 +483,7 @@ namespace cds { namespace container { void clear() { value_type v; - while ( pop(v) ); + while ( pop(v)); } /// Returns queue's item count diff --git a/cds/details/aligned_type.h b/cds/details/aligned_type.h index 1eddfa6e..2ebd656e 100644 --- a/cds/details/aligned_type.h +++ b/cds/details/aligned_type.h @@ -41,7 +41,7 @@ namespace cds { namespace details { equal to another type alignment. For example, the following declaration produces an error in Microsoft Visual Studio 2008 compiler: \code typedef double my_double; - typedef __declspec(align( __alignof(my_double) )) int aligned_int; + typedef __declspec(align( __alignof(my_double))) int aligned_int; \endcode In MS VS, the __declspec(align(N)) construction requires that N must be a integer constant (1, 2, 4 and so on) but not an integer constant expression. diff --git a/cds/details/bit_reverse_counter.h b/cds/details/bit_reverse_counter.h index 945432f4..002e79e3 100644 --- a/cds/details/bit_reverse_counter.h +++ b/cds/details/bit_reverse_counter.h @@ -75,7 +75,7 @@ namespace cds { namespace bitop { --m_nCounter; int nBit; for ( nBit = m_nHighBit - 1; nBit >= 0; --nBit ) { - if ( cds::bitop::complement( m_nReversed, nBit ) ) + if ( cds::bitop::complement( m_nReversed, nBit )) break; } if ( nBit < 0 ) { diff --git a/cds/details/bitop_generic.h b/cds/details/bitop_generic.h index e5eedd0d..3eae7964 100644 --- a/cds/details/bitop_generic.h +++ b/cds/details/bitop_generic.h @@ -164,7 +164,7 @@ namespace cds { return 0; if ( x & 0xffffffffu ) return lsb32( (uint32_t) x ); - return lsb32( (uint32_t) (x >> 32) ) + 32; + return lsb32( (uint32_t) (x >> 32)) + 32; } #endif @@ -198,7 +198,7 @@ namespace cds { static inline uint64_t rbo64( uint64_t x ) { // Low 32bit Hight 32bit - return ( static_cast(rbo32( (uint32_t) x )) << 32 ) | ( static_cast( rbo32( (uint32_t) (x >> 32) ))); + return ( static_cast(rbo32( (uint32_t) x )) << 32 ) | ( static_cast( rbo32( (uint32_t) (x >> 32)))); } #endif @@ -225,7 +225,7 @@ namespace cds { # ifdef cds_beans_zbc64_DEFINED return 64 - zbc64( x ); # else - return sbc32( (uint32_t) (x >> 32) ) + sbc32( (uint32_t) x ); + return sbc32( (uint32_t) (x >> 32)) + sbc32( (uint32_t) x ); # endif } #endif diff --git a/cds/details/bounded_array.h b/cds/details/bounded_array.h index 88751b62..12796347 100644 --- a/cds/details/bounded_array.h +++ b/cds/details/bounded_array.h @@ -77,24 +77,24 @@ namespace cds { explicit bounded_array( size_t nCapacity ///< capacity ) - : m_arr( allocator_impl().NewArray( nCapacity ) ) + : m_arr( allocator_impl().NewArray( nCapacity )) , m_nCapacity( nCapacity ) {} ~bounded_array() { - allocator_impl().Delete( m_arr, capacity() ); + allocator_impl().Delete( m_arr, capacity()); } const value_type& operator []( size_t nItem ) const { - assert( nItem < capacity() ); + assert( nItem < capacity()); return m_arr[nItem]; } value_type& operator []( size_t nItem ) { - assert( nItem < capacity() ); + assert( nItem < capacity()); return m_arr[nItem]; } diff --git a/cds/details/defs.h b/cds/details/defs.h index b83701bb..671b6961 100644 --- a/cds/details/defs.h +++ b/cds/details/defs.h @@ -150,7 +150,7 @@ int plugin_entry_point() { // Attach the thread if it is not attached yet - if ( !cds::threading::Manager::isThreadAttached() ) + if ( !cds::threading::Manager::isThreadAttached()) cds::threading::Manager::attachThread(); // Do some work with HP-related containers diff --git a/cds/details/marked_ptr.h b/cds/details/marked_ptr.h index 1a02c038..de43ea73 100644 --- a/cds/details/marked_ptr.h +++ b/cds/details/marked_ptr.h @@ -162,7 +162,7 @@ namespace cds { marked_ptr& operator &=( int nBits ) CDS_NOEXCEPT { assert( (nBits & pointer_bitmask) == 0 ); - m_ptr = to_ptr( to_int() & (pointer_bitmask | nBits) ); + m_ptr = to_ptr( to_int() & (pointer_bitmask | nBits)); return *this; } @@ -365,7 +365,7 @@ CDS_CXX11_ATOMIC_BEGIN_NAMESPACE {} CDS_CONSTEXPR explicit atomic(marked_ptr val) CDS_NOEXCEPT - : m_atomic( val.all() ) + : m_atomic( val.all()) {} CDS_CONSTEXPR explicit atomic(T * p) CDS_NOEXCEPT : m_atomic( p ) diff --git a/cds/gc/details/dhp.h b/cds/gc/details/dhp.h index 79a655b2..92747657 100644 --- a/cds/gc/details/dhp.h +++ b/cds/gc/details/dhp.h @@ -318,7 +318,7 @@ namespace cds { namespace gc { do { pLast->m_pNext.store( pHead, atomics::memory_order_relaxed ); // pHead is changed by compare_exchange_weak - } while ( !m_pHead.compare_exchange_weak( pHead, pFirst, atomics::memory_order_release, atomics::memory_order_relaxed ) ); + } while ( !m_pHead.compare_exchange_weak( pHead, pFirst, atomics::memory_order_release, atomics::memory_order_relaxed )); return m_nItemCount.fetch_add( nSize, atomics::memory_order_relaxed ) + 1; } @@ -668,15 +668,15 @@ namespace cds { namespace gc { /**@anchor dhp_gc_retirePtr */ template - void retirePtr( T * p, void (* pFunc)(T *) ) + void retirePtr( T * p, void (* pFunc)(T *)) { - retirePtr( retired_ptr( reinterpret_cast( p ), reinterpret_cast( pFunc ) ) ); + retirePtr( retired_ptr( reinterpret_cast( p ), reinterpret_cast( pFunc )) ); } /// Places retired pointer \p into thread's array of retired pointer for deferred reclamation void retirePtr( retired_ptr const& p ) { - if ( m_RetiredBuffer.push( m_RetiredAllocator.alloc(p)) >= m_nLiberateThreshold.load(atomics::memory_order_relaxed) ) + if ( m_RetiredBuffer.push( m_RetiredAllocator.alloc(p)) >= m_nLiberateThreshold.load(atomics::memory_order_relaxed)) scan(); } @@ -736,7 +736,7 @@ namespace cds { namespace gc { public: /// Default constructor ThreadGC() - : m_gc( GarbageCollector::instance() ) + : m_gc( GarbageCollector::instance()) , m_pList( nullptr ) , m_pFree( nullptr ) {} @@ -852,7 +852,7 @@ namespace cds { namespace gc { /// Places retired pointer \p and its deleter \p pFunc into list of retired pointer for deferred reclamation template - void retirePtr( T * p, void (* pFunc)(T *) ) + void retirePtr( T * p, void (* pFunc)(T *)) { m_gc.retirePtr( p, pFunc ); } diff --git a/cds/gc/details/hp.h b/cds/gc/details/hp.h index 9855a227..cfd68b93 100644 --- a/cds/gc/details/hp.h +++ b/cds/gc/details/hp.h @@ -134,19 +134,19 @@ namespace cds { /// Set vector size. Uses internally void size( size_t nSize ) { - assert( nSize <= capacity() ); + assert( nSize <= capacity()); m_nSize = nSize; } /// Pushes retired pointer to the vector void push( retired_ptr const& p ) { - assert( m_nSize < capacity() ); + assert( m_nSize < capacity()); m_arr[ m_nSize ] = p; ++m_nSize; } - /// Checks if the vector is full (size() == capacity() ) + /// Checks if the vector is full (size() == capacity()) bool isFull() const CDS_NOEXCEPT { return m_nSize >= capacity(); @@ -307,7 +307,7 @@ namespace cds { ~hplist_node() { assert( m_idOwner.load( atomics::memory_order_relaxed ) == OS::c_NullThreadId ); - assert( m_bFree.load(atomics::memory_order_relaxed) ); + assert( m_bFree.load(atomics::memory_order_relaxed)); } //@endcond }; @@ -553,7 +553,7 @@ namespace cds { public: /// Default constructor ThreadGC() - : m_HzpManager( GarbageCollector::instance() ), + : m_HzpManager( GarbageCollector::instance()), m_pHzpRec( nullptr ) {} @@ -617,7 +617,7 @@ namespace cds { /// Places retired pointer \p and its deleter \p pFunc into thread's array of retired pointer for deferred reclamation template - void retirePtr( T * p, void (* pFunc)(T *) ) + void retirePtr( T * p, void (* pFunc)(T *)) { retirePtr( details::retired_ptr( reinterpret_cast( p ), reinterpret_cast( pFunc ))); } @@ -627,7 +627,7 @@ namespace cds { { m_pHzpRec->m_arrRetired.push( p ); - if ( m_pHzpRec->m_arrRetired.isFull() ) { + if ( m_pHzpRec->m_arrRetired.isFull()) { // Max of retired pointer count is reached. Do scan scan(); } @@ -657,12 +657,12 @@ namespace cds { namespace gc { namespace hp { namespace details { inline retired_vector::retired_vector( const cds::gc::hp::GarbageCollector& HzpMgr ) - : m_arr( HzpMgr.getMaxRetiredPtrCount() ), + : m_arr( HzpMgr.getMaxRetiredPtrCount()), m_nSize(0) {} inline hp_record::hp_record( const cds::gc::hp::GarbageCollector& HzpMgr ) - : m_hzp( HzpMgr.getHazardPointerCount() ) + : m_hzp( HzpMgr.getHazardPointerCount()) , m_arrRetired( HzpMgr ) , m_nSync( 0 ) {} diff --git a/cds/gc/details/hp_alloc.h b/cds/gc/details/hp_alloc.h index 27b86416..6ad47ca4 100644 --- a/cds/gc/details/hp_alloc.h +++ b/cds/gc/details/hp_alloc.h @@ -195,7 +195,7 @@ namespace cds { hp_guard* release( size_t nIndex ) CDS_NOEXCEPT { - assert( nIndex < capacity() ); + assert( nIndex < capacity()); hp_guard* p = m_arr[ nIndex ]; m_arr[ nIndex ] = nullptr; @@ -249,7 +249,7 @@ namespace cds { /// Dtor ~hp_allocator() { - allocator_impl().Delete( m_arrHazardPtr, capacity() ); + allocator_impl().Delete( m_arrHazardPtr, capacity()); } /// Get capacity of array @@ -342,7 +342,7 @@ namespace cds { /// Returns i-th hazard pointer hp_guard& operator []( size_t i ) CDS_NOEXCEPT { - assert( i < capacity() ); + assert( i < capacity()); return m_arrHazardPtr[i]; } diff --git a/cds/gc/details/retired_ptr.h b/cds/gc/details/retired_ptr.h index 636f099b..03e7c1a8 100644 --- a/cds/gc/details/retired_ptr.h +++ b/cds/gc/details/retired_ptr.h @@ -96,7 +96,7 @@ namespace cds { namespace gc { assert( m_p ); m_funcFree( m_p ); - CDS_STRICT_DO( clear() ); + CDS_STRICT_DO( clear()); } /// Checks if the retired pointer is not empty diff --git a/cds/gc/impl/dhp_decl.h b/cds/gc/impl/dhp_decl.h index ba4e4172..e4a46ad5 100644 --- a/cds/gc/impl/dhp_decl.h +++ b/cds/gc/impl/dhp_decl.h @@ -241,7 +241,7 @@ namespace cds { namespace gc { value_type * operator()( T * p ); }; \endcode - Really, the result of f( toGuard.load() ) is assigned to the hazard pointer. + Really, the result of f( toGuard.load()) is assigned to the hazard pointer. */ template T protect( atomics::atomic const& toGuard, Func f ) @@ -250,7 +250,7 @@ namespace cds { namespace gc { T pRet; do { pRet = pCur; - assign( f( pCur ) ); + assign( f( pCur )); pCur = toGuard.load(atomics::memory_order_acquire); } while ( pRet != pCur ); return pCur; @@ -287,13 +287,13 @@ namespace cds { namespace gc { template T* assign( cds::details::marked_ptr p ) { - return assign( p.ptr() ); + return assign( p.ptr()); } /// Copy from \p src guard to \p this guard void copy( Guard const& src ) { - assign( src.get_native() ); + assign( src.get_native()); } /// Clears value of the guard @@ -307,7 +307,7 @@ namespace cds { namespace gc { template T * get() const { - return reinterpret_cast( get_native() ); + return reinterpret_cast( get_native()); } /// Gets native guarded pointer stored @@ -390,7 +390,7 @@ namespace cds { namespace gc { { T pRet; do { - pRet = assign( nIndex, toGuard.load(atomics::memory_order_acquire) ); + pRet = assign( nIndex, toGuard.load(atomics::memory_order_acquire)); } while ( pRet != toGuard.load(atomics::memory_order_relaxed)); return pRet; @@ -411,14 +411,14 @@ namespace cds { namespace gc { value_type * operator()( T * p ); }; \endcode - Actually, the result of f( toGuard.load() ) is assigned to the hazard pointer. + Actually, the result of f( toGuard.load()) is assigned to the hazard pointer. */ template T protect( size_t nIndex, atomics::atomic const& toGuard, Func f ) { T pRet; do { - assign( nIndex, f( pRet = toGuard.load(atomics::memory_order_acquire) )); + assign( nIndex, f( pRet = toGuard.load(atomics::memory_order_acquire))); } while ( pRet != toGuard.load(atomics::memory_order_relaxed)); return pRet; @@ -447,13 +447,13 @@ namespace cds { namespace gc { template T * assign( size_t nIndex, cds::details::marked_ptr p ) { - return assign( nIndex, p.ptr() ); + return assign( nIndex, p.ptr()); } /// Copy guarded value from \p src guard to slot at index \p nIndex void copy( size_t nIndex, Guard const& src ) { - assign( nIndex, src.get_native() ); + assign( nIndex, src.get_native()); } /// Copy guarded value from slot \p nSrcIndex to slot at index \p nDestIndex @@ -465,7 +465,7 @@ namespace cds { namespace gc { /// Clear value of the slot \p nIndex void clear( size_t nIndex ) { - assert( nIndex < capacity() ); + assert( nIndex < capacity()); assert( m_arr[nIndex] != nullptr ); m_arr[nIndex]->pPost.store( nullptr, atomics::memory_order_release ); @@ -475,13 +475,13 @@ namespace cds { namespace gc { template T * get( size_t nIndex ) const { - return reinterpret_cast( get_native( nIndex ) ); + return reinterpret_cast( get_native( nIndex )); } /// Get native guarded pointer stored guarded_pointer get_native( size_t nIndex ) const { - assert( nIndex < capacity() ); + assert( nIndex < capacity()); assert( m_arr[nIndex] != nullptr ); return m_arr[nIndex]->pPost.load( atomics::memory_order_acquire ); @@ -490,7 +490,7 @@ namespace cds { namespace gc { //@cond dhp::details::guard_data* release( size_t nIndex ) CDS_NOEXCEPT { - assert( nIndex < capacity() ); + assert( nIndex < capacity()); dhp::details::guard_data* ret = m_arr[ nIndex ]; m_arr[nIndex] = nullptr; @@ -609,7 +609,7 @@ namespace cds { namespace gc { /// Ctor from \p Guard explicit guarded_ptr( Guard&& g ) CDS_NOEXCEPT - : m_guard( g.release() ) + : m_guard( g.release()) {} /// The guarded pointer is not copy-constructible @@ -634,7 +634,7 @@ namespace cds { namespace gc { /// Move-assignment from \p Guard guarded_ptr& operator=( Guard&& g ) CDS_NOEXCEPT { - std::swap( m_guard, g.guard_ref() ); + std::swap( m_guard, g.guard_ref()); return *this; } @@ -644,7 +644,7 @@ namespace cds { namespace gc { /// Returns a pointer to guarded value value_type * operator ->() const CDS_NOEXCEPT { - assert( !empty() ); + assert( !empty()); return value_cast()( reinterpret_cast(m_guard->get())); } @@ -658,7 +658,7 @@ namespace cds { namespace gc { /// Returns const reference to guarded value value_type const& operator *() const CDS_NOEXCEPT { - assert( !empty() ); + assert( !empty()); return *value_cast()(reinterpret_cast(m_guard->get())); } @@ -781,7 +781,7 @@ namespace cds { namespace gc { Deleting the pointer is the function \p pFunc call. */ template - static void retire( T * p, void (* pFunc)(T *) ) + static void retire( T * p, void (* pFunc)(T *)) { dhp::GarbageCollector::instance().retirePtr( p, pFunc ); } diff --git a/cds/gc/impl/dhp_impl.h b/cds/gc/impl/dhp_impl.h index 7f5c5bb4..70a68df7 100644 --- a/cds/gc/impl/dhp_impl.h +++ b/cds/gc/impl/dhp_impl.h @@ -72,7 +72,7 @@ namespace cds { namespace gc { ) : m_bPersistent( bPersistent ) { - if ( !cds::threading::Manager::isThreadAttached() ) + if ( !cds::threading::Manager::isThreadAttached()) cds::threading::Manager::attachThread(); } diff --git a/cds/gc/impl/hp_decl.h b/cds/gc/impl/hp_decl.h index 0ecd0108..601fc01c 100644 --- a/cds/gc/impl/hp_decl.h +++ b/cds/gc/impl/hp_decl.h @@ -243,7 +243,7 @@ namespace cds { namespace gc { value_type * operator()( T * p ); }; \endcode - Actually, the result of f( toGuard.load() ) is assigned to the hazard pointer. + Actually, the result of f( toGuard.load()) is assigned to the hazard pointer. @warning The guad object should be in linked state, otherwise the result is undefined */ @@ -256,7 +256,7 @@ namespace cds { namespace gc { T pRet; do { pRet = pCur; - assign( f( pCur ) ); + assign( f( pCur )); pCur = toGuard.load(atomics::memory_order_acquire); } while ( pRet != pCur ); return pCur; @@ -283,7 +283,7 @@ namespace cds { namespace gc { /// Copy a value guarded from \p src guard to \p this guard (valid only in linked state) void copy( Guard const& src ) { - assign( src.get_native() ); + assign( src.get_native()); } /// Store marked pointer \p p to the guard @@ -309,7 +309,7 @@ namespace cds { namespace gc { template T * get() const { - return reinterpret_cast( get_native() ); + return reinterpret_cast( get_native()); } /// Get native hazard pointer stored (valid only in linked state) @@ -392,7 +392,7 @@ namespace cds { namespace gc { T pRet; do { - pRet = assign( nIndex, toGuard.load(atomics::memory_order_acquire) ); + pRet = assign( nIndex, toGuard.load(atomics::memory_order_acquire)); } while ( pRet != toGuard.load(atomics::memory_order_acquire)); return pRet; @@ -413,16 +413,16 @@ namespace cds { namespace gc { value_type * operator()( T * p ); }; \endcode - Really, the result of f( toGuard.load() ) is assigned to the hazard pointer. + Really, the result of f( toGuard.load()) is assigned to the hazard pointer. */ template T protect( size_t nIndex, atomics::atomic const& toGuard, Func f ) { - assert( nIndex < capacity() ); + assert( nIndex < capacity()); T pRet; do { - assign( nIndex, f( pRet = toGuard.load(atomics::memory_order_acquire) )); + assign( nIndex, f( pRet = toGuard.load(atomics::memory_order_acquire))); } while ( pRet != toGuard.load(atomics::memory_order_acquire)); return pRet; @@ -443,13 +443,13 @@ namespace cds { namespace gc { template T * assign( size_t nIndex, cds::details::marked_ptr p ) { - return assign( nIndex, p.ptr() ); + return assign( nIndex, p.ptr()); } /// Copy guarded value from \p src guard to slot at index \p nIndex void copy( size_t nIndex, Guard const& src ) { - assign( nIndex, src.get_native() ); + assign( nIndex, src.get_native()); } /// Copy guarded value from slot \p nSrcIndex to slot at index \p nDestIndex @@ -468,13 +468,13 @@ namespace cds { namespace gc { template T * get( size_t nIndex ) const { - return reinterpret_cast( get_native( nIndex ) ); + return reinterpret_cast( get_native( nIndex )); } /// Get native hazard pointer stored guarded_pointer get_native( size_t nIndex ) const { - assert( nIndex < capacity() ); + assert( nIndex < capacity()); return m_arr[nIndex]->get(); } @@ -597,7 +597,7 @@ namespace cds { namespace gc { /// Ctor from \p Guard explicit guarded_ptr( Guard&& g ) CDS_NOEXCEPT - : m_pGuard( g.release() ) + : m_pGuard( g.release()) {} /// The guarded pointer is not copy-constructible @@ -622,7 +622,7 @@ namespace cds { namespace gc { /// Move-assignment from \p Guard guarded_ptr& operator=( Guard&& g ) CDS_NOEXCEPT { - std::swap( m_pGuard, g.guard_ref() ); + std::swap( m_pGuard, g.guard_ref()); return *this; } @@ -632,7 +632,7 @@ namespace cds { namespace gc { /// Returns a pointer to guarded value value_type * operator ->() const CDS_NOEXCEPT { - assert( !empty() ); + assert( !empty()); return value_cast()( reinterpret_cast(m_pGuard->get())); } @@ -646,7 +646,7 @@ namespace cds { namespace gc { /// Returns const reference to guarded value value_type const& operator *() const CDS_NOEXCEPT { - assert( !empty() ); + assert( !empty()); return *value_cast()(reinterpret_cast(m_pGuard->get())); } @@ -792,7 +792,7 @@ namespace cds { namespace gc { Deleting the pointer is the function \p pFunc call. */ template - static void retire( T * p, void (* pFunc)(T *) ); // inline in hp_impl.h + static void retire( T * p, void (* pFunc)(T *)); // inline in hp_impl.h /// Retire pointer \p p with functor of type \p Disposer /** @@ -857,7 +857,7 @@ namespace cds { namespace gc { scan_type nScanType ///< new scan strategy ) { - hp::GarbageCollector::instance().setScanType( static_cast(nScanType) ); + hp::GarbageCollector::instance().setScanType( static_cast(nScanType)); } /// Checks if Hazard Pointer GC is constructed and may be used diff --git a/cds/gc/impl/hp_impl.h b/cds/gc/impl/hp_impl.h index 995a8bd0..36398880 100644 --- a/cds/gc/impl/hp_impl.h +++ b/cds/gc/impl/hp_impl.h @@ -49,7 +49,7 @@ namespace cds { namespace gc { ) : m_bPersistent( bPersistent ) { - if ( !threading::Manager::isThreadAttached() ) + if ( !threading::Manager::isThreadAttached()) threading::Manager::attachThread(); } @@ -120,7 +120,7 @@ namespace cds { namespace gc { template inline T * HP::GuardArray::assign( size_t nIndex, T* p ) { - assert( nIndex < capacity() ); + assert( nIndex < capacity()); m_arr.set(nIndex, p); hp::get_thread_gc().sync(); @@ -128,7 +128,7 @@ namespace cds { namespace gc { } template - inline void HP::retire( T * p, void (* pFunc)(T *) ) + inline void HP::retire( T * p, void (* pFunc)(T *)) { cds::threading::getGC().retirePtr( p, pFunc ); } diff --git a/cds/init.h b/cds/init.h index 7b76d6bc..bf7fac3a 100644 --- a/cds/init.h +++ b/cds/init.h @@ -65,7 +65,7 @@ namespace cds { { CDS_UNUSED( nFeatureFlags ); - if ( cds::details::init_first_call() ) + if ( cds::details::init_first_call()) { cds::OS::topology::init(); cds::threading::ThreadData::s_nProcCount = cds::OS::topology::processor_count(); @@ -85,7 +85,7 @@ namespace cds { */ static inline void Terminate() { - if ( cds::details::fini_last_call() ) { + if ( cds::details::fini_last_call()) { cds::threading::Manager::fini(); cds::OS::topology::fini(); diff --git a/cds/intrusive/cuckoo_set.h b/cds/intrusive/cuckoo_set.h index da98cc0d..a279bd56 100644 --- a/cds/intrusive/cuckoo_set.h +++ b/cds/intrusive/cuckoo_set.h @@ -413,10 +413,10 @@ namespace cds { namespace intrusive { { public: // placeholder ctor - lock_array(): lock_array_type( typename lock_array_type::select_cell_policy(2) ) {} + lock_array(): lock_array_type( typename lock_array_type::select_cell_policy(2)) {} // real ctor - lock_array( size_t nCapacity ): lock_array_type( nCapacity, typename lock_array_type::select_cell_policy(nCapacity) ) {} + lock_array( size_t nCapacity ): lock_array_type( nCapacity, typename lock_array_type::select_cell_policy(nCapacity)) {} }; class scoped_lock: public std::unique_lock< lock_array_type > @@ -469,7 +469,7 @@ namespace cds { namespace intrusive { if ( m_bLocked ) { m_guard[0] = &(policy.m_Locks[0].at(nCell)); for ( unsigned int i = 1; i < c_nArity; ++i ) { - m_guard[i] = &( policy.m_Locks[i].at( policy.m_Locks[i].lock( arrHash[i] )) ); + m_guard[i] = &( policy.m_Locks[i].at( policy.m_Locks[i].lock( arrHash[i] ))); } } else { @@ -703,7 +703,7 @@ namespace cds { namespace intrusive { lock_array_ptr create_lock_array( size_t nCapacity ) { - return lock_array_ptr( lock_array_allocator().New( nCapacity ), lock_array_disposer() ); + return lock_array_ptr( lock_array_allocator().New( nCapacity ), lock_array_disposer()); } void acquire( size_t const * arrHash, lock_array_ptr * pLockArr, lock_type ** parrLock ) @@ -723,7 +723,7 @@ namespace cds { namespace intrusive { // wait while resizing while ( true ) { who = m_Owner.load( atomics::memory_order_acquire ); - if ( !( who & 1 ) || (who >> 1) == (me & c_nOwnerMask) ) + if ( !( who & 1 ) || (who >> 1) == (me & c_nOwnerMask)) break; bkoff(); m_Stat.onCellWaitResizing(); @@ -743,7 +743,7 @@ namespace cds { namespace intrusive { } who = m_Owner.load( atomics::memory_order_acquire ); - if ( ( !(who & 1) || (who >> 1) == (me & c_nOwnerMask) ) && m_arrLocks[0] == pLockArr[0] ) { + if ( ( !(who & 1) || (who >> 1) == (me & c_nOwnerMask)) && m_arrLocks[0] == pLockArr[0] ) { m_Stat.onCellLock(); return; } @@ -778,7 +778,7 @@ namespace cds { namespace intrusive { parrLock[0] = &(m_arrLocks[0]->at(nCell)); for ( unsigned int i = 1; i < c_nArity; ++i ) { - parrLock[i] = &( m_arrLocks[i]->at( m_arrLocks[i]->lock( arrHash[i] & nMask)) ); + parrLock[i] = &( m_arrLocks[i]->at( m_arrLocks[i]->lock( arrHash[i] & nMask))); } m_Stat.onSecondCellLock(); @@ -1335,7 +1335,7 @@ namespace cds { namespace intrusive { { node_type * pPrev = itPrev.pNode; node_type * pWhat = itWhat.pNode; - assert( (!pPrev && pWhat == pHead) || (pPrev && pPrev->m_pNext == pWhat) ); + assert( (!pPrev && pWhat == pHead) || (pPrev && pPrev->m_pNext == pWhat)); if ( pPrev ) pPrev->m_pNext = pWhat->m_pNext; @@ -1993,7 +1993,7 @@ namespace cds { namespace intrusive { void allocate_bucket_tables( size_t nSize ) { - assert( cds::beans::is_power2( nSize ) ); + assert( cds::beans::is_power2( nSize )); m_nBucketMask = nSize - 1; bucket_table_allocator alloc; @@ -2041,7 +2041,7 @@ namespace cds { namespace intrusive { unsigned int nTable = contains( arrPos, arrHash, val, pred ); if ( nTable != c_nUndefTable ) { node_type& node = *arrPos[nTable].itFound; - f( *node_traits::to_value_ptr(node) ); + f( *node_traits::to_value_ptr(node)); bucket( nTable, arrHash[nTable]).remove( arrPos[nTable].itPrev, arrPos[nTable].itFound ); --m_ItemCounter; m_Stat.onEraseSuccess(); @@ -2094,14 +2094,14 @@ namespace cds { namespace intrusive { return true; } - pVal = node_traits::to_value_ptr( *refBucket.begin() ); + pVal = node_traits::to_value_ptr( *refBucket.begin()); copy_hash( arrHash, *pVal ); scoped_cell_trylock guard2( m_MutexPolicy, arrHash ); - if ( !guard2.locked() ) + if ( !guard2.locked()) continue ; // try one more time - refBucket.remove( typename bucket_entry::iterator(), refBucket.begin() ); + refBucket.remove( typename bucket_entry::iterator(), refBucket.begin()); unsigned int i = (nTable + 1) % c_nArity; @@ -2110,7 +2110,7 @@ namespace cds { namespace intrusive { bucket_entry& bkt = bucket( i, arrHash[i] ); if ( bkt.size() < m_nProbesetThreshold ) { position pos; - contains_action::find( bkt, pos, i, arrHash[i], *pVal, key_predicate() ) ; // must return false! + contains_action::find( bkt, pos, i, arrHash[i], *pVal, key_predicate()) ; // must return false! bkt.insert_after( pos.itPrev, node_traits::to_node_ptr( pVal )); m_Stat.onSuccessRelocateRound(); return true; @@ -2124,7 +2124,7 @@ namespace cds { namespace intrusive { bucket_entry& bkt = bucket( i, arrHash[i] ); if ( bkt.size() < m_nProbesetSize ) { position pos; - contains_action::find( bkt, pos, i, arrHash[i], *pVal, key_predicate() ) ; // must return false! + contains_action::find( bkt, pos, i, arrHash[i], *pVal, key_predicate()) ; // must return false! bkt.insert_after( pos.itPrev, node_traits::to_node_ptr( pVal )); nTable = i; memcpy( arrGoalHash, arrHash, sizeof(arrHash)); @@ -2154,7 +2154,7 @@ namespace cds { namespace intrusive { { scoped_resize_lock guard( m_MutexPolicy ); - if ( nOldCapacity != bucket_count() ) { + if ( nOldCapacity != bucket_count()) { m_Stat.onFalseResizeCall(); return; } @@ -2179,7 +2179,7 @@ namespace cds { namespace intrusive { value_type& val = *node_traits::to_value_ptr( *it ); copy_hash( arrHash, val ); - contains( arrPos, arrHash, val, key_predicate() ) ; // must return c_nUndefTable + contains( arrPos, arrHash, val, key_predicate()) ; // must return c_nUndefTable for ( unsigned int i = 0; i < c_nArity; ++i ) { bucket_entry& refBucket = bucket( i, arrHash[i] ); @@ -2195,7 +2195,7 @@ namespace cds { namespace intrusive { if ( refBucket.size() < m_nProbesetSize ) { refBucket.insert_after( arrPos[i].itPrev, &*it ); assert( refBucket.size() > 1 ); - copy_hash( arrHash, *node_traits::to_value_ptr( *refBucket.begin()) ); + copy_hash( arrHash, *node_traits::to_value_ptr( *refBucket.begin())); m_Stat.onResizeRelocateCall(); relocate( i, arrHash ); break; @@ -2231,7 +2231,7 @@ namespace cds { namespace intrusive { Probe set threshold = probe set size - 1 */ CuckooSet() - : m_nProbesetSize( calc_probeset_size(0) ) + : m_nProbesetSize( calc_probeset_size(0)) , m_nProbesetThreshold( m_nProbesetSize - 1 ) , m_MutexPolicy( c_nDefaultInitialSize ) { @@ -2251,7 +2251,7 @@ namespace cds { namespace intrusive { , unsigned int nProbesetSize ///< probe set size , unsigned int nProbesetThreshold = 0 ///< probe set threshold, nProbesetThreshold < nProbesetSize. If 0, nProbesetThreshold = nProbesetSize - 1 ) - : m_nProbesetSize( calc_probeset_size(nProbesetSize) ) + : m_nProbesetSize( calc_probeset_size(nProbesetSize)) , m_nProbesetThreshold( nProbesetThreshold ? nProbesetThreshold : m_nProbesetSize - 1 ) , m_MutexPolicy( cds::beans::ceil2(nInitialSize ? nInitialSize : c_nDefaultInitialSize )) { @@ -2268,7 +2268,7 @@ namespace cds { namespace intrusive { CuckooSet( hash_tuple_type const& h ///< hash functor tuple of type std::tuple where n == \ref c_nArity ) - : m_nProbesetSize( calc_probeset_size(0) ) + : m_nProbesetSize( calc_probeset_size(0)) , m_nProbesetThreshold( m_nProbesetSize -1 ) , m_Hash( h ) , m_MutexPolicy( c_nDefaultInitialSize ) @@ -2290,7 +2290,7 @@ namespace cds { namespace intrusive { , unsigned int nProbesetThreshold ///< probe set threshold, nProbesetThreshold < nProbesetSize. If 0, nProbesetThreshold = nProbesetSize - 1 , hash_tuple_type const& h ///< hash functor tuple of type std::tuple where n == \ref c_nArity ) - : m_nProbesetSize( calc_probeset_size(nProbesetSize) ) + : m_nProbesetSize( calc_probeset_size(nProbesetSize)) , m_nProbesetThreshold( nProbesetThreshold ? nProbesetThreshold : m_nProbesetSize - 1) , m_Hash( h ) , m_MutexPolicy( cds::beans::ceil2(nInitialSize ? nInitialSize : c_nDefaultInitialSize )) @@ -2308,9 +2308,9 @@ namespace cds { namespace intrusive { CuckooSet( hash_tuple_type&& h ///< hash functor tuple of type std::tuple where n == \ref c_nArity ) - : m_nProbesetSize( calc_probeset_size(0) ) + : m_nProbesetSize( calc_probeset_size(0)) , m_nProbesetThreshold( m_nProbesetSize / 2 ) - , m_Hash( std::forward(h) ) + , m_Hash( std::forward(h)) , m_MutexPolicy( c_nDefaultInitialSize ) { check_common_constraints(); @@ -2330,9 +2330,9 @@ namespace cds { namespace intrusive { , unsigned int nProbesetThreshold ///< probe set threshold, nProbesetThreshold < nProbesetSize. If 0, nProbesetThreshold = nProbesetSize - 1 , hash_tuple_type&& h ///< hash functor tuple of type std::tuple where n == \ref c_nArity ) - : m_nProbesetSize( calc_probeset_size(nProbesetSize) ) + : m_nProbesetSize( calc_probeset_size(nProbesetSize)) , m_nProbesetThreshold( nProbesetThreshold ? nProbesetThreshold : m_nProbesetSize - 1) - , m_Hash( std::forward(h) ) + , m_Hash( std::forward(h)) , m_MutexPolicy( cds::beans::ceil2(nInitialSize ? nInitialSize : c_nDefaultInitialSize )) { check_common_constraints(); @@ -2389,7 +2389,7 @@ namespace cds { namespace intrusive { { scoped_cell_lock guard( m_MutexPolicy, arrHash ); - if ( contains( arrPos, arrHash, val, key_predicate() ) != c_nUndefTable ) { + if ( contains( arrPos, arrHash, val, key_predicate()) != c_nUndefTable ) { m_Stat.onInsertFailed(); return false; } @@ -2413,7 +2413,7 @@ namespace cds { namespace intrusive { ++m_ItemCounter; nGoalTable = i; assert( refBucket.size() > 1 ); - copy_hash( arrHash, *node_traits::to_value_ptr( *refBucket.begin()) ); + copy_hash( arrHash, *node_traits::to_value_ptr( *refBucket.begin())); goto do_relocate; } } @@ -2475,7 +2475,7 @@ namespace cds { namespace intrusive { { scoped_cell_lock guard( m_MutexPolicy, arrHash ); - unsigned int nTable = contains( arrPos, arrHash, val, key_predicate() ); + unsigned int nTable = contains( arrPos, arrHash, val, key_predicate()); if ( nTable != c_nUndefTable ) { func( false, *node_traits::to_value_ptr( *arrPos[nTable].itFound ), val ); m_Stat.onUpdateExist(); @@ -2507,7 +2507,7 @@ namespace cds { namespace intrusive { ++m_ItemCounter; nGoalTable = i; assert( refBucket.size() > 1 ); - copy_hash( arrHash, *node_traits::to_value_ptr( *refBucket.begin()) ); + copy_hash( arrHash, *node_traits::to_value_ptr( *refBucket.begin())); goto do_relocate; } } @@ -2555,7 +2555,7 @@ namespace cds { namespace intrusive { { scoped_cell_lock guard( m_MutexPolicy, arrHash ); - unsigned int nTable = contains( arrPos, arrHash, val, key_predicate() ); + unsigned int nTable = contains( arrPos, arrHash, val, key_predicate()); if ( nTable != c_nUndefTable && node_traits::to_value_ptr(*arrPos[nTable].itFound) == &val ) { bucket( nTable, arrHash[nTable]).remove( arrPos[nTable].itPrev, arrPos[nTable].itFound ); --m_ItemCounter; @@ -2740,7 +2740,7 @@ namespace cds { namespace intrusive { */ void clear() { - clear_and_dispose( disposer() ); + clear_and_dispose( disposer()); } /// Clears the set and calls \p disposer for each item diff --git a/cds/intrusive/details/ellen_bintree_base.h b/cds/intrusive/details/ellen_bintree_base.h index 551ef3e8..a3398f3b 100644 --- a/cds/intrusive/details/ellen_bintree_base.h +++ b/cds/intrusive/details/ellen_bintree_base.h @@ -240,14 +240,14 @@ namespace cds { namespace intrusive { : base_class( true ) , m_pLeft( nullptr ) , m_pRight( nullptr ) - , m_pUpdate( update_ptr() ) + , m_pUpdate( update_ptr()) , m_nEmptyUpdate(0) {} //@cond update_ptr null_update_desc() { - return update_ptr( reinterpret_cast( (++m_nEmptyUpdate << 2) & 0xFFFF ) ); + return update_ptr( reinterpret_cast( (++m_nEmptyUpdate << 2) & 0xFFFF )); } base_class * get_child( bool bRight, atomics::memory_order mo ) const @@ -629,9 +629,9 @@ namespace cds { namespace intrusive { template int operator()( internal_node const& n1, internal_node const& n2 ) const { - if ( n1.infinite_key() ) + if ( n1.infinite_key()) return n2.infinite_key() ? n1.infinite_key() - n2.infinite_key() : 1; - else if ( n2.infinite_key() ) + else if ( n2.infinite_key()) return -1; return operator()( n1.m_Key, n2.m_Key ); } @@ -639,7 +639,7 @@ namespace cds { namespace intrusive { template int operator()( internal_node const& n, Q const& v ) const { - if ( n.infinite_key() ) + if ( n.infinite_key()) return 1; return operator()( n.m_Key, v ); } @@ -647,7 +647,7 @@ namespace cds { namespace intrusive { template int operator()( Q const& v, internal_node const& n ) const { - if ( n.infinite_key() ) + if ( n.infinite_key()) return -1; return operator()( v, n.m_Key ); } @@ -655,7 +655,7 @@ namespace cds { namespace intrusive { template int operator()( node const& n1, node const& n2 ) const { - if ( n1.infinite_key() != n2.infinite_key() ) + if ( n1.infinite_key() != n2.infinite_key()) return n1.infinite_key() - n2.infinite_key(); return operator()( *node_traits::to_value_ptr( n1 ), *node_traits::to_value_ptr( n2 )); } @@ -663,7 +663,7 @@ namespace cds { namespace intrusive { template int operator()( node const& n, Q const& v ) const { - if ( n.infinite_key() ) + if ( n.infinite_key()) return 1; return operator()( *node_traits::to_value_ptr( n ), v ); } @@ -671,24 +671,24 @@ namespace cds { namespace intrusive { template int operator()( Q const& v, node const& n ) const { - if ( n.infinite_key() ) + if ( n.infinite_key()) return -1; - return operator()( v, *node_traits::to_value_ptr( n ) ); + return operator()( v, *node_traits::to_value_ptr( n )); } template int operator()( base_node const& n1, base_node const& n2 ) const { - if ( n1.infinite_key() != n2.infinite_key() ) + if ( n1.infinite_key() != n2.infinite_key()) return n1.infinite_key() - n2.infinite_key(); - if ( n1.is_leaf() ) { - if ( n2.is_leaf() ) + if ( n1.is_leaf()) { + if ( n2.is_leaf()) return operator()( node_traits::to_leaf_node( n1 ), node_traits::to_leaf_node( n2 )); else return operator()( node_traits::to_leaf_node( n1 ), node_traits::to_internal_node( n2 )); } - if ( n2.is_leaf() ) + if ( n2.is_leaf()) return operator()( node_traits::to_internal_node( n1 ), node_traits::to_leaf_node( n2 )); else return operator()( node_traits::to_internal_node( n1 ), node_traits::to_internal_node( n2 )); @@ -699,7 +699,7 @@ namespace cds { namespace intrusive { { if ( n.infinite_key()) return 1; - if ( n.is_leaf() ) + if ( n.is_leaf()) return operator()( node_traits::to_leaf_node( n ), v ); return operator()( node_traits::to_internal_node( n ), v ); } @@ -713,7 +713,7 @@ namespace cds { namespace intrusive { template int operator()( base_node const& i, internal_node const& n ) const { - if ( i.is_leaf() ) + if ( i.is_leaf()) return operator()( static_cast(i), n ); return operator()( static_cast const&>(i), n ); } @@ -727,8 +727,8 @@ namespace cds { namespace intrusive { template int operator()( node const& n, internal_node > const& i ) const { - if ( !n.infinite_key() ) { - if ( i.infinite_key() ) + if ( !n.infinite_key()) { + if ( i.infinite_key()) return -1; return operator()( n, i.m_Key ); } diff --git a/cds/intrusive/details/michael_set_base.h b/cds/intrusive/details/michael_set_base.h index aa135fdf..7abd08e6 100644 --- a/cds/intrusive/details/michael_set_base.h +++ b/cds/intrusive/details/michael_set_base.h @@ -134,11 +134,11 @@ namespace cds { namespace intrusive { void next() { if ( m_pCurBucket < m_pEndBucket ) { - if ( ++m_itList != m_pCurBucket->end() ) + if ( ++m_itList != m_pCurBucket->end()) return; while ( ++m_pCurBucket < m_pEndBucket ) { m_itList = m_pCurBucket->begin(); - if ( m_itList != m_pCurBucket->end() ) + if ( m_itList != m_pCurBucket->end()) return; } } @@ -162,7 +162,7 @@ namespace cds { namespace intrusive { , m_itList( it ) , m_pEndBucket( pLast ) { - if ( it == pFirst->end() ) + if ( it == pFirst->end()) next(); } diff --git a/cds/intrusive/details/skip_list_base.h b/cds/intrusive/details/skip_list_base.h index 51de4129..a3c0ea23 100644 --- a/cds/intrusive/details/skip_list_base.h +++ b/cds/intrusive/details/skip_list_base.h @@ -107,8 +107,8 @@ namespace cds { namespace intrusive { /// Access to element of next pointer array atomic_marked_ptr& next( unsigned int nLevel ) { - assert( nLevel < height() ); - assert( nLevel == 0 || (nLevel > 0 && m_arrNext != nullptr) ); + assert( nLevel < height()); + assert( nLevel == 0 || (nLevel > 0 && m_arrNext != nullptr)); # ifdef CDS_THREAD_SANITIZER_ENABLED // TSan false positive: m_arrNext is read-only array @@ -124,7 +124,7 @@ namespace cds { namespace intrusive { /// Access to element of next pointer array (const version) atomic_marked_ptr const& next( unsigned int nLevel ) const { - assert( nLevel < height() ); + assert( nLevel < height()); assert( nLevel == 0 || nLevel > 0 && m_arrNext != nullptr ); # ifdef CDS_THREAD_SANITIZER_ENABLED @@ -686,7 +686,7 @@ namespace cds { namespace intrusive { static node_type * make_tower( node_type * pNode, unsigned int nHeight ) { if ( nHeight > 1 ) - pNode->make_tower( nHeight, tower_allocator().NewArray( nHeight - 1, nullptr ) ); + pNode->make_tower( nHeight, tower_allocator().NewArray( nHeight - 1, nullptr )); return pNode; } diff --git a/cds/intrusive/details/split_list_base.h b/cds/intrusive/details/split_list_base.h index 44b7d349..d24ddb3f 100644 --- a/cds/intrusive/details/split_list_base.h +++ b/cds/intrusive/details/split_list_base.h @@ -54,14 +54,14 @@ namespace cds { namespace intrusive { hash_node() : m_nHash( 0 ) { - assert( is_dummy() ); + assert( is_dummy()); } /// Initializes dummy node with \p nHash value hash_node( size_t nHash ) : m_nHash( nHash ) { - assert( is_dummy() ); + assert( is_dummy()); } /// Checks if the node is dummy node @@ -88,14 +88,14 @@ namespace cds { namespace intrusive { node() : hash_node(0) { - assert( is_dummy() ); + assert( is_dummy()); } /// Initializes dummy node with \p nHash value node( size_t nHash ) : hash_node( nHash ) { - assert( is_dummy() ); + assert( is_dummy()); } /// Checks if the node is dummy node @@ -114,14 +114,14 @@ namespace cds { namespace intrusive { node() : hash_node( 0 ) { - assert( is_dummy() ); + assert( is_dummy()); } /// Initializes dummy node with \p nHash value node( size_t nHash ) : hash_node( nHash ) { - assert( is_dummy() ); + assert( is_dummy()); } /// Checks if the node is dummy node @@ -416,11 +416,11 @@ namespace cds { namespace intrusive { size_t nLoadFactor ///< Load factor ) : m_nLoadFactor( nLoadFactor > 0 ? nLoadFactor : (size_t) 1 ) - , m_nCapacity( cds::beans::ceil2( nItemCount / m_nLoadFactor ) ) + , m_nCapacity( cds::beans::ceil2( nItemCount / m_nLoadFactor )) , m_nAuxNodeAllocated( 0 ) { // m_nCapacity must be power of 2 - assert( cds::beans::is_power2( m_nCapacity ) ); + assert( cds::beans::is_power2( m_nCapacity )); allocate_table(); } @@ -433,14 +433,14 @@ namespace cds { namespace intrusive { /// Returns head node of bucket \p nBucket aux_node_type * bucket( size_t nBucket ) const { - assert( nBucket < capacity() ); + assert( nBucket < capacity()); return m_Table[ nBucket ].load(memory_model::memory_order_acquire); } /// Set \p pNode as a head of bucket \p nBucket void bucket( size_t nBucket, aux_node_type * pNode ) { - assert( nBucket < capacity() ); + assert( nBucket < capacity()); assert( bucket( nBucket ) == nullptr ); m_Table[ nBucket ].store( pNode, memory_model::memory_order_release ); @@ -449,10 +449,10 @@ namespace cds { namespace intrusive { /// Allocates auxiliary node; can return \p nullptr if the table exhausted aux_node_type* alloc_aux_node() { - if ( m_nAuxNodeAllocated.load( memory_model::memory_order_relaxed ) < capacity() ) { + if ( m_nAuxNodeAllocated.load( memory_model::memory_order_relaxed ) < capacity()) { // alloc next free node from m_auxNode size_t const idx = m_nAuxNodeAllocated.fetch_add( 1, memory_model::memory_order_relaxed ); - if ( idx < capacity() ) + if ( idx < capacity()) return new( &m_auxNode[idx] ) aux_node_type(); } @@ -560,7 +560,7 @@ namespace cds { namespace intrusive { metrics() : nSegmentCount( 1024 ) , nSegmentSize( 512 ) - , nSegmentSizeLog2( cds::beans::log2( nSegmentSize ) ) + , nSegmentSizeLog2( cds::beans::log2( nSegmentSize )) , nLoadFactor( 1 ) , nCapacity( nSegmentCount * nSegmentSize ) {} @@ -670,7 +670,7 @@ namespace cds { namespace intrusive { aux_node_segment* new_aux_segment = allocate_aux_segment(); new_aux_segment->aux_node_count.fetch_add( 1, memory_model::memory_order_relaxed ); if ( m_auxNodeList.compare_exchange_strong( aux_segment, new_aux_segment, memory_model::memory_order_relaxed, atomics::memory_order_relaxed )) - return new( new_aux_segment->segment() ) aux_node_type(); + return new( new_aux_segment->segment()) aux_node_type(); free_aux_segment( new_aux_segment ); } @@ -761,11 +761,11 @@ namespace cds { namespace intrusive { void init() { // m_nSegmentSize must be 2**N - assert( cds::beans::is_power2( m_metrics.nSegmentSize ) ); + assert( cds::beans::is_power2( m_metrics.nSegmentSize )); assert( (((size_t)1) << m_metrics.nSegmentSizeLog2) == m_metrics.nSegmentSize ); // m_nSegmentCount must be 2**K - assert( cds::beans::is_power2( m_metrics.nSegmentCount ) ); + assert( cds::beans::is_power2( m_metrics.nSegmentCount )); m_Segments = allocate_table(); m_auxNodeList = allocate_aux_segment(); @@ -837,12 +837,12 @@ namespace cds { namespace intrusive { if ( n1->m_nHash != n2->m_nHash ) return n1->m_nHash < n2->m_nHash ? -1 : 1; - if ( n1->is_dummy() ) { - assert( n2->is_dummy() ); + if ( n1->is_dummy()) { + assert( n2->is_dummy()); return 0; } - assert( !n1->is_dummy() && !n2->is_dummy() ); + assert( !n1->is_dummy() && !n2->is_dummy()); return native_key_comparator()(v1, v2); } @@ -854,7 +854,7 @@ namespace cds { namespace intrusive { if ( n->m_nHash != q.nHash ) return n->m_nHash < q.nHash ? -1 : 1; - assert( !n->is_dummy() ); + assert( !n->is_dummy()); return native_key_comparator()(v, q.val); } @@ -870,7 +870,7 @@ namespace cds { namespace intrusive { void operator()( value_type * v ) { splitlist_node_type * p = static_cast(native_node_traits::to_node_ptr( v )); - if ( !p->is_dummy() ) + if ( !p->is_dummy()) native_disposer()(v); } }; @@ -913,25 +913,25 @@ namespace cds { namespace intrusive { /// Convert node reference to value pointer static value_type * to_value_ptr( node_type& n ) { - return base_class::to_value_ptr( static_cast(n) ); + return base_class::to_value_ptr( static_cast(n)); } /// Convert node pointer to value pointer static value_type * to_value_ptr( node_type * n ) { - return base_class::to_value_ptr( static_cast(n) ); + return base_class::to_value_ptr( static_cast(n)); } /// Convert node reference to value pointer (const version) static const value_type * to_value_ptr( node_type const & n ) { - return base_class::to_value_ptr( static_cast(n) ); + return base_class::to_value_ptr( static_cast(n)); } /// Convert node pointer to value pointer (const version) static const value_type * to_value_ptr( node_type const * n ) { - return base_class::to_value_ptr( static_cast(n) ); + return base_class::to_value_ptr( static_cast(n)); } }; @@ -947,7 +947,7 @@ namespace cds { namespace intrusive { if ( n->m_nHash != q.nHash ) return n->m_nHash < q.nHash ? -1 : 1; - assert( !n->is_dummy() ); + assert( !n->is_dummy()); return base_class()(v, q.val); } @@ -958,7 +958,7 @@ namespace cds { namespace intrusive { if ( n->m_nHash != q.nHash ) return q.nHash < n->m_nHash ? -1 : 1; - assert( !n->is_dummy() ); + assert( !n->is_dummy()); return base_class()(q.val, v); } @@ -995,12 +995,12 @@ namespace cds { namespace intrusive { if ( n1.m_nHash != n2.m_nHash ) return n1.m_nHash < n2.m_nHash ? -1 : 1; - if ( n1.is_dummy() ) { - assert( n2.is_dummy() ); + if ( n1.is_dummy()) { + assert( n2.is_dummy()); return 0; } - assert( !n1.is_dummy() && !n2.is_dummy() ); + assert( !n1.is_dummy() && !n2.is_dummy()); return native_key_comparator()(v1, v2); } @@ -1012,7 +1012,7 @@ namespace cds { namespace intrusive { if ( n.m_nHash != q.nHash ) return n.m_nHash < q.nHash ? -1 : 1; - assert( !n.is_dummy() ); + assert( !n.is_dummy()); return native_key_comparator()(v, q.val); } @@ -1028,7 +1028,7 @@ namespace cds { namespace intrusive { void operator()( value_type * v ) { hash_node* p = static_cast( v ); - if ( !p->is_dummy() ) + if ( !p->is_dummy()) native_disposer()(v); } }; @@ -1083,7 +1083,7 @@ namespace cds { namespace intrusive { if ( n.m_nHash != q.nHash ) return n.m_nHash < q.nHash ? -1 : 1; - assert( !n.is_dummy() ); + assert( !n.is_dummy()); return base_class()(v, q.val); } @@ -1094,7 +1094,7 @@ namespace cds { namespace intrusive { if ( n.m_nHash != q.nHash ) return q.nHash < n.m_nHash ? -1 : 1; - assert( !n.is_dummy() ); + assert( !n.is_dummy()); return base_class()(q.val, v); } @@ -1163,7 +1163,7 @@ namespace cds { namespace intrusive { , m_itEnd( itEnd ) { // skip dummy nodes - while ( m_itCur != m_itEnd && node_traits::to_node_ptr( *m_itCur )->is_dummy() ) + while ( m_itCur != m_itEnd && node_traits::to_node_ptr( *m_itCur )->is_dummy()) ++m_itCur; } @@ -1183,7 +1183,7 @@ namespace cds { namespace intrusive { if ( m_itCur != m_itEnd ) { do { ++m_itCur; - } while ( m_itCur != m_itEnd && node_traits::to_node_ptr( *m_itCur )->is_dummy() ); + } while ( m_itCur != m_itEnd && node_traits::to_node_ptr( *m_itCur )->is_dummy()); } return *this; } diff --git a/cds/intrusive/fcqueue.h b/cds/intrusive/fcqueue.h index 7a11ada9..23b0bb4f 100644 --- a/cds/intrusive/fcqueue.h +++ b/cds/intrusive/fcqueue.h @@ -187,7 +187,7 @@ namespace cds { namespace intrusive { else m_FlatCombining.combine( op_enq, pRec, *this ); - assert( pRec->is_done() ); + assert( pRec->is_done()); m_FlatCombining.release_record( pRec ); m_FlatCombining.internal_statistics().onEnqueue(); return true; @@ -213,7 +213,7 @@ namespace cds { namespace intrusive { else m_FlatCombining.combine( op_deq, pRec, *this ); - assert( pRec->is_done() ); + assert( pRec->is_done()); m_FlatCombining.release_record( pRec ); m_FlatCombining.internal_statistics().onDequeue( pRec->bEmpty ); @@ -240,7 +240,7 @@ namespace cds { namespace intrusive { else m_FlatCombining.combine( bDispose ? op_clear_and_dispose : op_clear, pRec, *this ); - assert( pRec->is_done() ); + assert( pRec->is_done()); m_FlatCombining.release_record( pRec ); } @@ -289,10 +289,10 @@ namespace cds { namespace intrusive { // All TSan warnings are false positive CDS_TSAN_ANNOTATE_IGNORE_RW_BEGIN; - switch ( pRec->op() ) { + switch ( pRec->op()) { case op_enq: assert( pRec->pVal ); - m_Queue.push_back( *(pRec->pVal ) ); + m_Queue.push_back( *(pRec->pVal )); break; case op_deq: pRec->bEmpty = m_Queue.empty(); @@ -305,7 +305,7 @@ namespace cds { namespace intrusive { m_Queue.clear(); break; case op_clear_and_dispose: - m_Queue.clear_and_dispose( disposer() ); + m_Queue.clear_and_dispose( disposer()); break; default: assert(false); @@ -323,10 +323,10 @@ namespace cds { namespace intrusive { typedef typename fc_kernel::iterator fc_iterator; for ( fc_iterator it = itBegin, itPrev = itEnd; it != itEnd; ++it ) { - switch ( it->op() ) { + switch ( it->op()) { case op_enq: case op_deq: - if ( m_Queue.empty() ) { + if ( m_Queue.empty()) { if ( itPrev != itEnd && collide( *itPrev, *it )) itPrev = itEnd; else @@ -343,9 +343,9 @@ namespace cds { namespace intrusive { //@cond bool collide( fc_record& rec1, fc_record& rec2 ) { - assert( m_Queue.empty() ); + assert( m_Queue.empty()); - switch ( rec1.op() ) { + switch ( rec1.op()) { case op_enq: if ( rec2.op() == op_deq ) { assert(rec1.pVal); diff --git a/cds/intrusive/fcstack.h b/cds/intrusive/fcstack.h index fd4d804d..7e634cfb 100644 --- a/cds/intrusive/fcstack.h +++ b/cds/intrusive/fcstack.h @@ -188,7 +188,7 @@ namespace cds { namespace intrusive { else m_FlatCombining.combine( op_push, pRec, *this ); - assert( pRec->is_done() ); + assert( pRec->is_done()); m_FlatCombining.release_record( pRec ); m_FlatCombining.internal_statistics().onPush(); return true; @@ -205,7 +205,7 @@ namespace cds { namespace intrusive { else m_FlatCombining.combine( op_pop, pRec, *this ); - assert( pRec->is_done() ); + assert( pRec->is_done()); m_FlatCombining.release_record( pRec ); m_FlatCombining.internal_statistics().onPop( pRec->bEmpty ); @@ -226,7 +226,7 @@ namespace cds { namespace intrusive { else m_FlatCombining.combine( bDispose ? op_clear_and_dispose : op_clear, pRec, *this ); - assert( pRec->is_done() ); + assert( pRec->is_done()); m_FlatCombining.release_record( pRec ); } @@ -274,10 +274,10 @@ namespace cds { namespace intrusive { // this function is called under FC mutex, so switch TSan off CDS_TSAN_ANNOTATE_IGNORE_RW_BEGIN; - switch ( pRec->op() ) { + switch ( pRec->op()) { case op_push: assert( pRec->pVal ); - m_Stack.push_front( *(pRec->pVal ) ); + m_Stack.push_front( *(pRec->pVal )); break; case op_pop: pRec->bEmpty = m_Stack.empty(); @@ -290,7 +290,7 @@ namespace cds { namespace intrusive { m_Stack.clear(); break; case op_clear_and_dispose: - m_Stack.clear_and_dispose( disposer() ); + m_Stack.clear_and_dispose( disposer()); break; default: assert(false); @@ -307,7 +307,7 @@ namespace cds { namespace intrusive { typedef typename fc_kernel::iterator fc_iterator; for ( fc_iterator it = itBegin, itPrev = itEnd; it != itEnd; ++it ) { - switch ( it->op() ) { + switch ( it->op()) { case op_push: case op_pop: if ( itPrev != itEnd && collide( *itPrev, *it )) @@ -325,7 +325,7 @@ namespace cds { namespace intrusive { //@cond bool collide( fc_record& rec1, fc_record& rec2 ) { - switch ( rec1.op() ) { + switch ( rec1.op()) { case op_push: if ( rec2.op() == op_pop ) { assert(rec1.pVal); diff --git a/cds/intrusive/free_list.h b/cds/intrusive/free_list.h index 0a27bd8c..4bbcfa9e 100644 --- a/cds/intrusive/free_list.h +++ b/cds/intrusive/free_list.h @@ -115,7 +115,7 @@ namespace cds { namespace intrusive { */ ~FreeList() { - assert( empty() ); + assert( empty()); } /// Puts \p pNode to the free list diff --git a/cds/intrusive/free_list_cached.h b/cds/intrusive/free_list_cached.h index ef80887b..1f86a279 100644 --- a/cds/intrusive/free_list_cached.h +++ b/cds/intrusive/free_list_cached.h @@ -49,7 +49,7 @@ namespace cds { namespace intrusive { to put that item into the cache if its corresponding slot is empty. The slot is calculated by current thread id: \code - int slot = std::hash()( std::this_thread::get_id() ) & (CacheSize - 1); + int slot = std::hash()( std::this_thread::get_id()) & (CacheSize - 1); \endcode When getting the free-list checks the corresponding cache slot. If it is not empty, its @@ -133,7 +133,7 @@ namespace cds { namespace intrusive { /// Checks whether the free list is empty bool empty() const { - if ( !m_freeList.empty() ) + if ( !m_freeList.empty()) return false; for ( auto& cell : m_cache ) { @@ -175,7 +175,7 @@ namespace cds { namespace intrusive { //@cond size_t get_hash() { - return std::hash()( std::this_thread::get_id() ) & (c_cache_size - 1); + return std::hash()( std::this_thread::get_id()) & (c_cache_size - 1); } //@endcond private: diff --git a/cds/intrusive/free_list_tagged.h b/cds/intrusive/free_list_tagged.h index 63e76c0b..a7340838 100644 --- a/cds/intrusive/free_list_tagged.h +++ b/cds/intrusive/free_list_tagged.h @@ -130,7 +130,7 @@ namespace cds { namespace intrusive { */ ~TaggedFreeList() { - assert( empty() ); + assert( empty()); } /// Puts \p pNode to the free list diff --git a/cds/intrusive/impl/ellen_bintree.h b/cds/intrusive/impl/ellen_bintree.h index 51c40759..0321fbb9 100644 --- a/cds/intrusive/impl/ellen_bintree.h +++ b/cds/intrusive/impl/ellen_bintree.h @@ -168,13 +168,13 @@ namespace cds { namespace intrusive { { static internal_node const& to_internal_node( tree_node const& n ) { - assert( n.is_internal() ); + assert( n.is_internal()); return static_cast( n ); } static leaf_node const& to_leaf_node( tree_node const& n ) { - assert( n.is_leaf() ); + assert( n.is_leaf()); return static_cast( n ); } }; @@ -282,7 +282,7 @@ namespace cds { namespace intrusive { void retire_node( tree_node * pNode ) const { - if ( pNode->is_leaf() ) { + if ( pNode->is_leaf()) { assert( static_cast( pNode ) != &m_LeafInf1 ); assert( static_cast( pNode ) != &m_LeafInf2 ); @@ -366,8 +366,8 @@ namespace cds { namespace intrusive { back_off bkoff; for ( ;; ) { - if ( search( res, val, node_compare() )) { - if ( pNewInternal.get() ) + if ( search( res, val, node_compare())) { + if ( pNewInternal.get()) m_Stat.onInternalNodeDeleted() ; // unique_internal_node_ptr deletes internal node m_Stat.onInsertFailed(); return false; @@ -375,8 +375,8 @@ namespace cds { namespace intrusive { if ( res.updGrandParent.bits() == update_desc::Clean && res.updParent.bits() == update_desc::Clean ) { - if ( !pNewInternal.get() ) - pNewInternal.reset( alloc_internal_node() ); + if ( !pNewInternal.get()) + pNewInternal.reset( alloc_internal_node()); if ( try_insert( val, pNewInternal.get(), res )) { f( val ); @@ -433,9 +433,9 @@ namespace cds { namespace intrusive { back_off bkoff; for ( ;; ) { - if ( search( res, val, node_compare() )) { + if ( search( res, val, node_compare())) { func( false, *node_traits::to_value_ptr( res.pLeaf ), val ); - if ( pNewInternal.get() ) + if ( pNewInternal.get()) m_Stat.onInternalNodeDeleted() ; // unique_internal_node_ptr deletes internal node m_Stat.onUpdateExist(); return std::make_pair( true, false ); @@ -445,8 +445,8 @@ namespace cds { namespace intrusive { if ( !bAllowInsert ) return std::make_pair( false, false ); - if ( !pNewInternal.get() ) - pNewInternal.reset( alloc_internal_node() ); + if ( !pNewInternal.get()) + pNewInternal.reset( alloc_internal_node()); if ( try_insert( val, pNewInternal.get(), res )) { func( true, val, val ); @@ -662,7 +662,7 @@ namespace cds { namespace intrusive { bool contains( Q const& key ) const { search_result res; - if ( search( res, key, node_compare() )) { + if ( search( res, key, node_compare())) { m_Stat.onFindSuccess(); return true; } @@ -697,7 +697,7 @@ namespace cds { namespace intrusive { > compare_functor; search_result res; - if ( search( res, key, compare_functor() )) { + if ( search( res, key, compare_functor())) { m_Stat.onFindSuccess(); return true; } @@ -807,7 +807,7 @@ namespace cds { namespace intrusive { this sequence \code tree.clear(); - assert( tree.empty() ); + assert( tree.empty()); \endcode the assertion could be raised. @@ -834,7 +834,7 @@ namespace cds { namespace intrusive { tree_node * pLeaf = const_cast( &m_Root ); // Get leftmost leaf - while ( pLeaf->is_internal() ) { + while ( pLeaf->is_internal()) { pGrandParent = pParent; pParent = static_cast( pLeaf ); pLeaf = pParent->m_pLeft.load( memory_model::memory_order_relaxed ); @@ -848,10 +848,10 @@ namespace cds { namespace intrusive { // Remove leftmost leaf and its parent node assert( pGrandParent ); assert( pParent ); - assert( pLeaf->is_leaf() ); + assert( pLeaf->is_leaf()); pGrandParent->m_pLeft.store( pParent->m_pRight.load( memory_model::memory_order_relaxed ), memory_model::memory_order_relaxed ); - free_leaf_node( node_traits::to_value_ptr( static_cast( pLeaf ) ) ); + free_leaf_node( node_traits::to_value_ptr( static_cast( pLeaf )) ); free_internal_node( pParent ); } } @@ -900,11 +900,11 @@ namespace cds { namespace intrusive { && node_compare()( *pLeft, *pRight ) < 0 ) { bool bRet = true; - if ( pLeft->is_internal() ) - bRet = check_consistency( static_cast( pLeft ) ); + if ( pLeft->is_internal()) + bRet = check_consistency( static_cast( pLeft )); assert( bRet ); - if ( bRet && pRight->is_internal() ) + if ( bRet && pRight->is_internal()) bRet = bRet && check_consistency( static_cast( pRight )); assert( bRet ); @@ -972,7 +972,7 @@ namespace cds { namespace intrusive { updParent = nullptr; bRightLeaf = false; tree_node * pLeaf = const_cast( &m_Root ); - while ( pLeaf->is_internal() ) { + while ( pLeaf->is_internal()) { res.guards.copy( search_result::Guard_GrandParent, search_result::Guard_Parent ); pGrandParent = pParent; res.guards.copy( search_result::Guard_Parent, search_result::Guard_Leaf ); @@ -983,7 +983,7 @@ namespace cds { namespace intrusive { updParent = search_protect_update( res, pParent->m_pUpdate ); - switch ( updParent.bits() ) { + switch ( updParent.bits()) { case update_desc::DFlag: case update_desc::Mark: m_Stat.onSearchRetry(); @@ -1000,8 +1000,8 @@ namespace cds { namespace intrusive { } } - assert( pLeaf->is_leaf() ); - nCmp = cmp( key, *static_cast(pLeaf) ); + assert( pLeaf->is_leaf()); + nCmp = cmp( key, *static_cast(pLeaf)); res.pGrandParent = pGrandParent; res.pParent = pParent; @@ -1026,7 +1026,7 @@ namespace cds { namespace intrusive { pGrandParent = nullptr; updParent = nullptr; tree_node * pLeaf = const_cast( &m_Root ); - while ( pLeaf->is_internal() ) { + while ( pLeaf->is_internal()) { res.guards.copy( search_result::Guard_GrandParent, search_result::Guard_Parent ); pGrandParent = pParent; res.guards.copy( search_result::Guard_Parent, search_result::Guard_Leaf ); @@ -1036,7 +1036,7 @@ namespace cds { namespace intrusive { updParent = search_protect_update( res, pParent->m_pUpdate ); - switch ( updParent.bits() ) { + switch ( updParent.bits()) { case update_desc::DFlag: case update_desc::Mark: m_Stat.onSearchRetry(); @@ -1055,7 +1055,7 @@ namespace cds { namespace intrusive { res.pGrandParent = pGrandParent; res.pParent = pParent; - assert( pLeaf->is_leaf() ); + assert( pLeaf->is_leaf()); res.pLeaf = static_cast( pLeaf ); res.updParent = updParent; res.updGrandParent = updGrandParent; @@ -1080,7 +1080,7 @@ namespace cds { namespace intrusive { updParent = nullptr; bRightLeaf = false; tree_node * pLeaf = const_cast( &m_Root ); - while ( pLeaf->is_internal() ) { + while ( pLeaf->is_internal()) { res.guards.copy( search_result::Guard_GrandParent, search_result::Guard_Parent ); pGrandParent = pParent; res.guards.copy( search_result::Guard_Parent, search_result::Guard_Leaf ); @@ -1091,7 +1091,7 @@ namespace cds { namespace intrusive { updParent = search_protect_update( res, pParent->m_pUpdate ); - switch ( updParent.bits() ) { + switch ( updParent.bits()) { case update_desc::DFlag: case update_desc::Mark: m_Stat.onSearchRetry(); @@ -1111,7 +1111,7 @@ namespace cds { namespace intrusive { res.pGrandParent = pGrandParent; res.pParent = pParent; - assert( pLeaf->is_leaf() ); + assert( pLeaf->is_leaf()); res.pLeaf = static_cast( pLeaf ); res.updParent = updParent; res.updGrandParent = updGrandParent; @@ -1125,18 +1125,18 @@ namespace cds { namespace intrusive { void help( update_ptr pUpdate ) { // pUpdate must be guarded! - switch ( pUpdate.bits() ) { + switch ( pUpdate.bits()) { case update_desc::IFlag: - help_insert( pUpdate.ptr() ); + help_insert( pUpdate.ptr()); m_Stat.onHelpInsert(); break; case update_desc::DFlag: - help_delete( pUpdate.ptr() ); + help_delete( pUpdate.ptr()); m_Stat.onHelpDelete(); break; case update_desc::Mark: //m_Stat.onHelpMark(); - //help_marked( pUpdate.ptr() ); + //help_marked( pUpdate.ptr()); break; } } @@ -1209,7 +1209,7 @@ namespace cds { namespace intrusive { static tree_node * protect_sibling( typename gc::Guard& guard, atomics::atomic& sibling ) { tree_node * pSibling = guard.protect( sibling, [](tree_node * p) -> internal_node* { return static_cast(p); } ); - if ( pSibling->is_leaf() ) + if ( pSibling->is_leaf()) guard.assign( node_traits::to_value_ptr( static_cast( pSibling ))); return pSibling; } @@ -1240,7 +1240,7 @@ namespace cds { namespace intrusive { bool try_insert( value_type& val, internal_node * pNewInternal, search_result& res ) { assert( res.updParent.bits() == update_desc::Clean ); - assert( res.pLeaf->is_leaf() ); + assert( res.pLeaf->is_leaf()); // check search result if ( res.pParent->get_child( res.bRightLeaf, memory_model::memory_order_acquire ) == res.pLeaf ) { @@ -1249,7 +1249,7 @@ namespace cds { namespace intrusive { int nCmp = node_compare()(val, *res.pLeaf); if ( nCmp < 0 ) { if ( res.pGrandParent ) { - assert( !res.pLeaf->infinite_key() ); + assert( !res.pLeaf->infinite_key()); pNewInternal->infinite_key( 0 ); key_extractor()(pNewInternal->m_Key, *node_traits::to_value_ptr( res.pLeaf )); } @@ -1261,13 +1261,13 @@ namespace cds { namespace intrusive { pNewInternal->m_pRight.store( static_cast(res.pLeaf), memory_model::memory_order_release ); } else { - assert( !res.pLeaf->is_internal() ); + assert( !res.pLeaf->is_internal()); pNewInternal->infinite_key( 0 ); key_extractor()(pNewInternal->m_Key, val); pNewInternal->m_pLeft.store( static_cast(res.pLeaf), memory_model::memory_order_relaxed ); pNewInternal->m_pRight.store( static_cast(pNewLeaf), memory_model::memory_order_release ); - assert( !res.pLeaf->infinite_key() ); + assert( !res.pLeaf->infinite_key()); } typename gc::Guard guard; @@ -1279,9 +1279,9 @@ namespace cds { namespace intrusive { pOp->iInfo.pLeaf = res.pLeaf; pOp->iInfo.bRightLeaf = res.bRightLeaf; - update_ptr updCur( res.updParent.ptr() ); + update_ptr updCur( res.updParent.ptr()); if ( res.pParent->m_pUpdate.compare_exchange_strong( updCur, update_ptr( pOp, update_desc::IFlag ), - memory_model::memory_order_acquire, atomics::memory_order_relaxed ) ) { + memory_model::memory_order_acquire, atomics::memory_order_relaxed )) { // do insert help_insert( pOp ); retire_update_desc( pOp ); @@ -1304,7 +1304,7 @@ namespace cds { namespace intrusive { back_off bkoff; for ( ;; ) { - if ( !search( res, val, cmp ) || !eq( val, *res.pLeaf ) ) { + if ( !search( res, val, cmp ) || !eq( val, *res.pLeaf )) { if ( pOp ) retire_update_desc( pOp ); m_Stat.onEraseFailed(); @@ -1314,7 +1314,7 @@ namespace cds { namespace intrusive { if ( res.updGrandParent.bits() == update_desc::Clean && res.updParent.bits() == update_desc::Clean ) { if ( !pOp ) pOp = alloc_update_desc(); - if ( check_delete_precondition( res ) ) { + if ( check_delete_precondition( res )) { typename gc::Guard guard; guard.assign( pOp ); @@ -1325,12 +1325,12 @@ namespace cds { namespace intrusive { pOp->dInfo.bRightParent = res.bRightParent; pOp->dInfo.bRightLeaf = res.bRightLeaf; - update_ptr updGP( res.updGrandParent.ptr() ); + update_ptr updGP( res.updGrandParent.ptr()); if ( res.pGrandParent->m_pUpdate.compare_exchange_strong( updGP, update_ptr( pOp, update_desc::DFlag ), - memory_model::memory_order_acquire, atomics::memory_order_relaxed ) ) { - if ( help_delete( pOp ) ) { + memory_model::memory_order_acquire, atomics::memory_order_relaxed )) { + if ( help_delete( pOp )) { // res.pLeaf is not deleted yet since it is guarded - f( *node_traits::to_value_ptr( res.pLeaf ) ); + f( *node_traits::to_value_ptr( res.pLeaf )); break; } pOp = nullptr; @@ -1365,7 +1365,7 @@ namespace cds { namespace intrusive { if ( res.updGrandParent.bits() == update_desc::Clean && res.updParent.bits() == update_desc::Clean ) { if ( !pOp ) pOp = alloc_update_desc(); - if ( check_delete_precondition( res ) ) { + if ( check_delete_precondition( res )) { typename gc::Guard guard; guard.assign( pOp ); @@ -1376,9 +1376,9 @@ namespace cds { namespace intrusive { pOp->dInfo.bRightParent = res.bRightParent; pOp->dInfo.bRightLeaf = res.bRightLeaf; - update_ptr updGP( res.updGrandParent.ptr() ); + update_ptr updGP( res.updGrandParent.ptr()); if ( res.pGrandParent->m_pUpdate.compare_exchange_strong( updGP, update_ptr( pOp, update_desc::DFlag ), - memory_model::memory_order_acquire, atomics::memory_order_relaxed ) ) { + memory_model::memory_order_acquire, atomics::memory_order_relaxed )) { if ( help_delete( pOp )) break; pOp = nullptr; @@ -1432,7 +1432,7 @@ namespace cds { namespace intrusive { if ( res.updGrandParent.bits() == update_desc::Clean && res.updParent.bits() == update_desc::Clean ) { if ( !pOp ) pOp = alloc_update_desc(); - if ( check_delete_precondition( res ) ) { + if ( check_delete_precondition( res )) { typename gc::Guard guard; guard.assign( pOp ); @@ -1443,11 +1443,11 @@ namespace cds { namespace intrusive { pOp->dInfo.bRightParent = res.bRightParent; pOp->dInfo.bRightLeaf = res.bRightLeaf; - update_ptr updGP( res.updGrandParent.ptr() ); + update_ptr updGP( res.updGrandParent.ptr()); if ( res.pGrandParent->m_pUpdate.compare_exchange_strong( updGP, update_ptr( pOp, update_desc::DFlag ), - memory_model::memory_order_acquire, atomics::memory_order_relaxed ) ) + memory_model::memory_order_acquire, atomics::memory_order_relaxed )) { - if ( help_delete( pOp ) ) + if ( help_delete( pOp )) break; pOp = nullptr; } @@ -1481,7 +1481,7 @@ namespace cds { namespace intrusive { if ( res.updGrandParent.bits() == update_desc::Clean && res.updParent.bits() == update_desc::Clean ) { if ( !pOp ) pOp = alloc_update_desc(); - if ( check_delete_precondition( res ) ) { + if ( check_delete_precondition( res )) { typename gc::Guard guard; guard.assign( pOp ); @@ -1492,7 +1492,7 @@ namespace cds { namespace intrusive { pOp->dInfo.bRightParent = res.bRightParent; pOp->dInfo.bRightLeaf = res.bRightLeaf; - update_ptr updGP( res.updGrandParent.ptr() ); + update_ptr updGP( res.updGrandParent.ptr()); if ( res.pGrandParent->m_pUpdate.compare_exchange_strong( updGP, update_ptr( pOp, update_desc::DFlag ), memory_model::memory_order_acquire, atomics::memory_order_relaxed )) { @@ -1516,7 +1516,7 @@ namespace cds { namespace intrusive { bool find_( Q& val, Func f ) const { search_result res; - if ( search( res, val, node_compare() )) { + if ( search( res, val, node_compare())) { assert( res.pLeaf ); f( *node_traits::to_value_ptr( res.pLeaf ), val ); @@ -1539,7 +1539,7 @@ namespace cds { namespace intrusive { > compare_functor; search_result res; - if ( search( res, val, compare_functor() )) { + if ( search( res, val, compare_functor())) { assert( res.pLeaf ); f( *node_traits::to_value_ptr( res.pLeaf ), val ); @@ -1555,7 +1555,7 @@ namespace cds { namespace intrusive { guarded_ptr get_( Q const& val ) const { search_result res; - if ( search( res, val, node_compare() ) ) { + if ( search( res, val, node_compare()) ) { assert( res.pLeaf ); m_Stat.onFindSuccess(); return guarded_ptr( res.guards.release( search_result::Guard_Leaf )); @@ -1578,7 +1578,7 @@ namespace cds { namespace intrusive { > compare_functor; search_result res; - if ( search( res, val, compare_functor() ) ) { + if ( search( res, val, compare_functor()) ) { assert( res.pLeaf ); m_Stat.onFindSuccess(); return guarded_ptr( res.guards.release( search_result::Guard_Leaf )); diff --git a/cds/intrusive/impl/iterable_list.h b/cds/intrusive/impl/iterable_list.h index f0ccb8cd..fa33dda7 100644 --- a/cds/intrusive/impl/iterable_list.h +++ b/cds/intrusive/impl/iterable_list.h @@ -333,7 +333,7 @@ namespace cds { namespace intrusive { this code \code if ( it1 == it2 ) - assert( &(*it1) == &(*it2) ); + assert( &(*it1) == &(*it2)); \endcode can throw assertion. The point is that the iterator stores the value of element which can be modified later by other thread. The guard inside the iterator prevents recycling that value so the iterator's value remains valid even after such changing. @@ -847,12 +847,12 @@ namespace cds { namespace intrusive { insert_position pos; while ( true ) { - if ( inserting_search( pHead, *pNode->data.load(memory_model::memory_order_relaxed).ptr(), pos, key_comparator() ) ) { + if ( inserting_search( pHead, *pNode->data.load(memory_model::memory_order_relaxed).ptr(), pos, key_comparator()) ) { m_Stat.onInsertFailed(); return false; } - if ( link_aux_node( pNode, pos ) ) { + if ( link_aux_node( pNode, pos )) { ++m_ItemCounter; m_Stat.onInsertSuccess(); return true; @@ -867,12 +867,12 @@ namespace cds { namespace intrusive { insert_position pos; while ( true ) { - if ( inserting_search( pHead, val, pos, key_comparator() )) { + if ( inserting_search( pHead, val, pos, key_comparator())) { m_Stat.onInsertFailed(); return false; } - if ( link_data( &val, pos ) ) { + if ( link_data( &val, pos )) { ++m_ItemCounter; m_Stat.onInsertSuccess(); return true; @@ -891,12 +891,12 @@ namespace cds { namespace intrusive { guard.assign( &val ); while ( true ) { - if ( inserting_search( pHead, val, pos, key_comparator() ) ) { + if ( inserting_search( pHead, val, pos, key_comparator()) ) { m_Stat.onInsertFailed(); return false; } - if ( link_data( &val, pos ) ) { + if ( link_data( &val, pos )) { f( val ); ++m_ItemCounter; m_Stat.onInsertSuccess(); @@ -916,7 +916,7 @@ namespace cds { namespace intrusive { guard.assign( &val ); while ( true ) { - if ( inserting_search( pHead, val, pos, key_comparator() ) ) { + if ( inserting_search( pHead, val, pos, key_comparator()) ) { // try to replace pCur->data with val assert( pos.pFound != nullptr ); assert( key_comparator()(*pos.pFound, val) == 0 ); @@ -1042,7 +1042,7 @@ namespace cds { namespace intrusive { bool find_at( node_type const* pHead, Q const& val, Compare cmp ) const { position pos; - if ( search( pHead, val, pos, cmp ) ) { + if ( search( pHead, val, pos, cmp )) { m_Stat.onFindSuccess(); return true; } @@ -1191,7 +1191,7 @@ namespace cds { namespace intrusive { void destroy( Predicate pred ) { node_type * pNode = m_Head.next.load( memory_model::memory_order_relaxed ); - while ( pNode != pNode->next.load( memory_model::memory_order_relaxed ) ) { + while ( pNode != pNode->next.load( memory_model::memory_order_relaxed )) { value_type * pVal = pNode->data.load( memory_model::memory_order_relaxed ).ptr(); node_type * pNext = pNode->next.load( memory_model::memory_order_relaxed ); bool const is_regular_node = !pVal || pred( pVal ); @@ -1257,14 +1257,14 @@ namespace cds { namespace intrusive { // and then set it to another. // To prevent this we mark pos.pCur data as undeletable by setting LSB marked_data_ptr valCur( pos.pFound ); - if ( !pos.pCur->data.compare_exchange_strong( valCur, valCur | 1, memory_model::memory_order_acquire, atomics::memory_order_relaxed ) ) { + if ( !pos.pCur->data.compare_exchange_strong( valCur, valCur | 1, memory_model::memory_order_acquire, atomics::memory_order_relaxed )) { // oops, pos.pCur data has been changed or another thread is setting pos.pPrev data m_Stat.onNodeMarkFailed(); return false; } marked_data_ptr valPrev( pos.pPrevVal ); - if ( !pos.pPrev->data.compare_exchange_strong( valPrev, valPrev | 1, memory_model::memory_order_acquire, atomics::memory_order_relaxed ) ) { + if ( !pos.pPrev->data.compare_exchange_strong( valPrev, valPrev | 1, memory_model::memory_order_acquire, atomics::memory_order_relaxed )) { pos.pCur->data.store( valCur, memory_model::memory_order_relaxed ); m_Stat.onNodeMarkFailed(); return false; @@ -1329,14 +1329,14 @@ namespace cds { namespace intrusive { // and then set it to another. // To prevent this we mark pos.pCur data as undeletable by setting LSB marked_data_ptr valCur( pos.pFound ); - if ( !pos.pCur->data.compare_exchange_strong( valCur, valCur | 1, memory_model::memory_order_acquire, atomics::memory_order_relaxed ) ) { + if ( !pos.pCur->data.compare_exchange_strong( valCur, valCur | 1, memory_model::memory_order_acquire, atomics::memory_order_relaxed )) { // oops, pos.pCur data has been changed or another thread is setting pos.pPrev data m_Stat.onNodeMarkFailed(); return false; } marked_data_ptr valPrev( pos.pPrevVal ); - if ( !pos.pPrev->data.compare_exchange_strong( valPrev, valPrev | 1, memory_model::memory_order_acquire, atomics::memory_order_relaxed ) ) { + if ( !pos.pPrev->data.compare_exchange_strong( valPrev, valPrev | 1, memory_model::memory_order_acquire, atomics::memory_order_relaxed )) { pos.pCur->data.store( valCur, memory_model::memory_order_relaxed ); m_Stat.onNodeMarkFailed(); return false; @@ -1369,7 +1369,7 @@ namespace cds { namespace intrusive { assert( pos.pFound != nullptr ); marked_data_ptr val( pos.pFound ); - if ( pos.pCur->data.compare_exchange_strong( val, marked_data_ptr(), memory_model::memory_order_acquire, atomics::memory_order_relaxed ) ) { + if ( pos.pCur->data.compare_exchange_strong( val, marked_data_ptr(), memory_model::memory_order_acquire, atomics::memory_order_relaxed )) { retire_data( pos.pFound ); return true; } diff --git a/cds/intrusive/impl/michael_list.h b/cds/intrusive/impl/michael_list.h index 4f8ef87b..3072fe20 100644 --- a/cds/intrusive/impl/michael_list.h +++ b/cds/intrusive/impl/michael_list.h @@ -1134,7 +1134,7 @@ namespace cds { namespace intrusive { bool find_at( atomic_node_ptr& refHead, Q const& val, Compare cmp ) { position pos; - if ( search( refHead, val, pos, cmp ) ) { + if ( search( refHead, val, pos, cmp )) { m_Stat.onFindSuccess(); return true; } diff --git a/cds/intrusive/impl/skip_list.h b/cds/intrusive/impl/skip_list.h index f666c9da..27023f41 100644 --- a/cds/intrusive/impl/skip_list.h +++ b/cds/intrusive/impl/skip_list.h @@ -65,7 +65,7 @@ namespace cds { namespace intrusive { protected: static value_type * gc_protect( marked_ptr p ) { - return node_traits::to_value_ptr( p.ptr() ); + return node_traits::to_value_ptr( p.ptr()); } void next() @@ -75,7 +75,7 @@ namespace cds { namespace intrusive { back_off bkoff; for (;;) { - if ( m_pNode->next( m_pNode->height() - 1 ).load( atomics::memory_order_acquire ).bits() ) { + if ( m_pNode->next( m_pNode->height() - 1 ).load( atomics::memory_order_acquire ).bits()) { // Current node is marked as deleted. So, its next pointer can point to anything // In this case we interrupt our iteration and returns end() iterator. *this = iterator(); @@ -84,12 +84,12 @@ namespace cds { namespace intrusive { marked_ptr p = m_guard.protect( (*m_pNode)[0], gc_protect ); node_type * pp = p.ptr(); - if ( p.bits() ) { + if ( p.bits()) { // p is marked as deleted. Spin waiting for physical removal bkoff(); continue; } - else if ( pp && pp->next( pp->height() - 1 ).load( atomics::memory_order_relaxed ).bits() ) { + else if ( pp && pp->next( pp->height() - 1 ).load( atomics::memory_order_relaxed ).bits()) { // p is marked as deleted. Spin waiting for physical removal bkoff(); continue; @@ -108,7 +108,7 @@ namespace cds { namespace intrusive { for (;;) { marked_ptr p = m_guard.protect( refHead[0], gc_protect ); - if ( !p.ptr() ) { + if ( !p.ptr()) { // empty skip-list m_guard.clear(); break; @@ -116,7 +116,7 @@ namespace cds { namespace intrusive { node_type * pp = p.ptr(); // Logically deleted node is marked from highest level - if ( !pp->next( pp->height() - 1 ).load( atomics::memory_order_acquire ).bits() ) { + if ( !pp->next( pp->height() - 1 ).load( atomics::memory_order_acquire ).bits()) { m_pNode = pp; break; } @@ -133,7 +133,7 @@ namespace cds { namespace intrusive { iterator( iterator const& s) : m_pNode( s.m_pNode ) { - m_guard.assign( node_traits::to_value_ptr(m_pNode) ); + m_guard.assign( node_traits::to_value_ptr(m_pNode)); } value_type * operator ->() const @@ -446,13 +446,13 @@ namespace cds { namespace intrusive { static value_type * gc_protect( marked_node_ptr p ) { - return node_traits::to_value_ptr( p.ptr() ); + return node_traits::to_value_ptr( p.ptr()); } static void dispose_node( value_type * pVal ) { assert( pVal != nullptr ); - typename node_builder::node_disposer()( node_traits::to_node_ptr(pVal) ); + typename node_builder::node_disposer()( node_traits::to_node_ptr(pVal)); disposer()( pVal ); } @@ -475,7 +475,7 @@ namespace cds { namespace intrusive { pos.guards.assign( nLevel * 2, node_traits::to_value_ptr( pPred )); while ( true ) { pCur = pos.guards.protect( nLevel * 2 + 1, pPred->next( nLevel ), gc_protect ); - if ( pCur.bits() ) { + if ( pCur.bits()) { // pCur.bits() means that pPred is logically deleted goto retry; } @@ -488,17 +488,17 @@ namespace cds { namespace intrusive { // pSucc contains deletion mark for pCur pSucc = pCur->next( nLevel ).load( memory_model::memory_order_acquire ); - if ( pPred->next( nLevel ).load( memory_model::memory_order_acquire ).all() != pCur.ptr() ) + if ( pPred->next( nLevel ).load( memory_model::memory_order_acquire ).all() != pCur.ptr()) goto retry; - if ( pSucc.bits() ) { + if ( pSucc.bits()) { // pCur is marked, i.e. logically deleted. - marked_node_ptr p( pCur.ptr() ); - if ( pPred->next( nLevel ).compare_exchange_strong( p, marked_node_ptr( pSucc.ptr() ), + marked_node_ptr p( pCur.ptr()); + if ( pPred->next( nLevel ).compare_exchange_strong( p, marked_node_ptr( pSucc.ptr()), memory_model::memory_order_acquire, atomics::memory_order_relaxed )) { if ( nLevel == 0 ) { - gc::retire( node_traits::to_value_ptr( pCur.ptr() ), dispose_node ); + gc::retire( node_traits::to_value_ptr( pCur.ptr()), dispose_node ); m_Stat.onEraseWhileFind(); } } @@ -551,22 +551,22 @@ namespace cds { namespace intrusive { // head cannot be deleted assert( pCur.bits() == 0 ); - if ( pCur.ptr() ) { + if ( pCur.ptr()) { // pSucc contains deletion mark for pCur pSucc = pCur->next( nLevel ).load( memory_model::memory_order_acquire ); - if ( pPred->next( nLevel ).load( memory_model::memory_order_acquire ).all() != pCur.ptr() ) + if ( pPred->next( nLevel ).load( memory_model::memory_order_acquire ).all() != pCur.ptr()) goto retry; - if ( pSucc.bits() ) { + if ( pSucc.bits()) { // pCur is marked, i.e. logically deleted. - marked_node_ptr p( pCur.ptr() ); - if ( pPred->next( nLevel ).compare_exchange_strong( p, marked_node_ptr( pSucc.ptr() ), + marked_node_ptr p( pCur.ptr()); + if ( pPred->next( nLevel ).compare_exchange_strong( p, marked_node_ptr( pSucc.ptr()), memory_model::memory_order_acquire, atomics::memory_order_relaxed )) { if ( nLevel == 0 ) { - gc::retire( node_traits::to_value_ptr( pCur.ptr() ), dispose_node ); + gc::retire( node_traits::to_value_ptr( pCur.ptr()), dispose_node ); m_Stat.onEraseWhileFind(); } } @@ -599,7 +599,7 @@ namespace cds { namespace intrusive { pos.guards.assign( nLevel * 2, node_traits::to_value_ptr( pPred )); while ( true ) { pCur = pos.guards.protect( nLevel * 2 + 1, pPred->next( nLevel ), gc_protect ); - if ( pCur.bits() ) { + if ( pCur.bits()) { // pCur.bits() means that pPred is logically deleted goto retry; } @@ -612,24 +612,24 @@ namespace cds { namespace intrusive { // pSucc contains deletion mark for pCur pSucc = pCur->next( nLevel ).load( memory_model::memory_order_acquire ); - if ( pPred->next( nLevel ).load( memory_model::memory_order_acquire ).all() != pCur.ptr() ) + if ( pPred->next( nLevel ).load( memory_model::memory_order_acquire ).all() != pCur.ptr()) goto retry; - if ( pSucc.bits() ) { + if ( pSucc.bits()) { // pCur is marked, i.e. logically deleted. - marked_node_ptr p( pCur.ptr() ); - if ( pPred->next( nLevel ).compare_exchange_strong( p, marked_node_ptr( pSucc.ptr() ), + marked_node_ptr p( pCur.ptr()); + if ( pPred->next( nLevel ).compare_exchange_strong( p, marked_node_ptr( pSucc.ptr()), memory_model::memory_order_acquire, atomics::memory_order_relaxed )) { if ( nLevel == 0 ) { - gc::retire( node_traits::to_value_ptr( pCur.ptr() ), dispose_node ); + gc::retire( node_traits::to_value_ptr( pCur.ptr()), dispose_node ); m_Stat.onEraseWhileFind(); } } goto retry; } else { - if ( !pSucc.ptr() ) + if ( !pSucc.ptr()) break; pPred = pCur.ptr(); @@ -672,7 +672,7 @@ namespace cds { namespace intrusive { if ( !pNode->next( nLevel ).compare_exchange_strong( p, q, memory_model::memory_order_release, atomics::memory_order_relaxed )) { // pNode has been marked as removed while we are inserting it // Stop inserting - assert( p.bits() ); + assert( p.bits()); m_Stat.onLogicDeleteWhileInsert(); return true; } @@ -712,7 +712,7 @@ namespace cds { namespace intrusive { } while ( true ) { - marked_node_ptr p( pDel->next(0).load(memory_model::memory_order_relaxed).ptr() ); + marked_node_ptr p( pDel->next(0).load(memory_model::memory_order_relaxed).ptr()); if ( pDel->next(0).compare_exchange_strong( p, p | 1, memory_model::memory_order_release, atomics::memory_order_relaxed )) { f( *node_traits::to_value_ptr( pDel )); @@ -723,7 +723,7 @@ namespace cds { namespace intrusive { for ( int nLevel = static_cast( pDel->height() - 1 ); nLevel >= 0; --nLevel ) { pSucc = pDel->next(nLevel).load(memory_model::memory_order_relaxed); if ( !pos.pPrev[nLevel]->next(nLevel).compare_exchange_strong( p, marked_node_ptr(pSucc.ptr()), - memory_model::memory_order_acquire, atomics::memory_order_relaxed) ) + memory_model::memory_order_acquire, atomics::memory_order_relaxed)) { // Make slow erase find_position( *node_traits::to_value_ptr( pDel ), pos, key_comparator(), false ); @@ -738,7 +738,7 @@ namespace cds { namespace intrusive { return true; } else { - if ( p.bits() ) { + if ( p.bits()) { // Another thread is deleting pDel right now return false; } @@ -769,7 +769,7 @@ namespace cds { namespace intrusive { continue; while ( pCur != pNull ) { - if ( pCur.bits() ) { + if ( pCur.bits()) { unsigned int nAttempt = 0; while ( pCur.bits() && nAttempt++ < 16 ) { bkoff(); @@ -777,15 +777,15 @@ namespace cds { namespace intrusive { } bkoff.reset(); - if ( pCur.bits() ) { + if ( pCur.bits()) { // Maybe, we are on deleted node sequence // Abort searching, try slow-path return find_fastpath_abort; } } - if ( pCur.ptr() ) { - int nCmp = cmp( *node_traits::to_value_ptr( pCur.ptr() ), val ); + if ( pCur.ptr()) { + int nCmp = cmp( *node_traits::to_value_ptr( pCur.ptr()), val ); if ( nCmp < 0 ) { guards.copy( 0, 1 ); pPred = pCur.ptr(); @@ -793,7 +793,7 @@ namespace cds { namespace intrusive { } else if ( nCmp == 0 ) { // found - f( *node_traits::to_value_ptr( pCur.ptr() ), val ); + f( *node_traits::to_value_ptr( pCur.ptr()), val ); return find_fastpath_found; } else // pCur > val - go down @@ -856,14 +856,14 @@ namespace cds { namespace intrusive { { position pos; - if ( !find_position( val, pos, cmp, false ) ) { + if ( !find_position( val, pos, cmp, false )) { m_Stat.onEraseFailed(); return false; } node_type * pDel = pos.pCur; typename gc::Guard gDel; - gDel.assign( node_traits::to_value_ptr(pDel) ); + gDel.assign( node_traits::to_value_ptr(pDel)); assert( cmp( *node_traits::to_value_ptr( pDel ), val ) == 0 ); unsigned int nHeight = pDel->height(); @@ -885,7 +885,7 @@ namespace cds { namespace intrusive { guarded_ptr gp; for (;;) { - if ( !find_position( val, pos, cmp, false ) ) { + if ( !find_position( val, pos, cmp, false )) { m_Stat.onExtractFailed(); return guarded_ptr(); } @@ -911,7 +911,7 @@ namespace cds { namespace intrusive { guarded_ptr gp; for (;;) { - if ( !find_min_position( pos ) ) { + if ( !find_min_position( pos )) { // The list is empty m_Stat.onExtractMinFailed(); return guarded_ptr(); @@ -920,7 +920,7 @@ namespace cds { namespace intrusive { node_type * pDel = pos.pCur; unsigned int nHeight = pDel->height(); - gp.reset( node_traits::to_value_ptr(pDel) ); + gp.reset( node_traits::to_value_ptr(pDel)); if ( try_remove_at( pDel, pos, [](value_type const&) {} )) { --m_ItemCounter; @@ -939,7 +939,7 @@ namespace cds { namespace intrusive { guarded_ptr gp; for (;;) { - if ( !find_max_position( pos ) ) { + if ( !find_max_position( pos )) { // The list is empty m_Stat.onExtractMaxFailed(); return guarded_ptr(); @@ -948,7 +948,7 @@ namespace cds { namespace intrusive { node_type * pDel = pos.pCur; unsigned int nHeight = pDel->height(); - gp.reset( node_traits::to_value_ptr(pDel) ); + gp.reset( node_traits::to_value_ptr(pDel)); if ( try_remove_at( pDel, pos, [](value_type const&) {} )) { --m_ItemCounter; @@ -1046,18 +1046,18 @@ namespace cds { namespace intrusive { /// Returns a forward iterator addressing the first element in a set iterator begin() { - return iterator( *m_Head.head() ); + return iterator( *m_Head.head()); } /// Returns a forward const iterator addressing the first element in a set const_iterator begin() const { - return const_iterator( *m_Head.head() ); + return const_iterator( *m_Head.head()); } /// Returns a forward const iterator addressing the first element in a set const_iterator cbegin() const { - return const_iterator( *m_Head.head() ); + return const_iterator( *m_Head.head()); } /// Returns a forward iterator that addresses the location succeeding the last element in a set. @@ -1257,7 +1257,7 @@ namespace cds { namespace intrusive { { position pos; - if ( !find_position( val, pos, key_comparator(), false ) ) { + if ( !find_position( val, pos, key_comparator(), false )) { m_Stat.onUnlinkFailed(); return false; } @@ -1267,7 +1267,7 @@ namespace cds { namespace intrusive { unsigned int nHeight = pDel->height(); typename gc::Guard gDel; - gDel.assign( node_traits::to_value_ptr(pDel) ); + gDel.assign( node_traits::to_value_ptr(pDel)); if ( node_traits::to_value_ptr( pDel ) == &val && try_remove_at( pDel, pos, [](value_type const&) {} )) { --m_ItemCounter; @@ -1311,7 +1311,7 @@ namespace cds { namespace intrusive { template guarded_ptr extract( Q const& key ) { - return extract_( key, key_comparator() ); + return extract_( key, key_comparator()); } /// Extracts the item from the set with comparing functor \p pred @@ -1327,7 +1327,7 @@ namespace cds { namespace intrusive { guarded_ptr extract_with( Q const& key, Less pred ) { CDS_UNUSED( pred ); - return extract_( key, cds::opt::details::make_comparator_from_less() ); + return extract_( key, cds::opt::details::make_comparator_from_less()); } /// Extracts an item with minimal key from the list @@ -1601,7 +1601,7 @@ namespace cds { namespace intrusive { template guarded_ptr get( Q const& key ) { - return get_with_( key, key_comparator() ); + return get_with_( key, key_comparator()); } /// Finds \p key and return the item found @@ -1617,7 +1617,7 @@ namespace cds { namespace intrusive { guarded_ptr get_with( Q const& key, Less pred ) { CDS_UNUSED( pred ); - return get_with_( key, cds::opt::details::make_comparator_from_less() ); + return get_with_( key, cds::opt::details::make_comparator_from_less()); } /// Returns item count in the set @@ -1645,7 +1645,7 @@ namespace cds { namespace intrusive { this sequence \code set.clear(); - assert( set.empty() ); + assert( set.empty()); \endcode the assertion could be raised. diff --git a/cds/intrusive/lazy_list_nogc.h b/cds/intrusive/lazy_list_nogc.h index 316f269a..e5a86f20 100644 --- a/cds/intrusive/lazy_list_nogc.h +++ b/cds/intrusive/lazy_list_nogc.h @@ -336,7 +336,7 @@ namespace cds { namespace intrusive { /// Returns a forward const iterator addressing the first element in a list const_iterator cbegin() const { - const_iterator it( const_cast(&m_Head) ); + const_iterator it( const_cast(&m_Head)); ++it; // skip dummy head return it; } @@ -349,7 +349,7 @@ namespace cds { namespace intrusive { /// Returns an const iterator that addresses the location succeeding the last element in a list const_iterator cend() const { - return const_iterator( const_cast(&m_Tail) ); + return const_iterator( const_cast(&m_Tail)); } public: @@ -509,7 +509,7 @@ namespace cds { namespace intrusive { template value_type * contains( Q const& key ) { - return find_at( &m_Head, key, key_comparator() ); + return find_at( &m_Head, key, key_comparator()); } //@cond template @@ -530,7 +530,7 @@ namespace cds { namespace intrusive { typename std::enable_if::type contains( Q const& key, Less pred ) { CDS_UNUSED( pred ); - return find_at( &m_Head, key, cds::opt::details::make_comparator_from_less() ); + return find_at( &m_Head, key, cds::opt::details::make_comparator_from_less()); } //@cond template @@ -586,7 +586,7 @@ namespace cds { namespace intrusive { */ void clear() { - clear( disposer() ); + clear( disposer()); } /// Checks if the list is empty @@ -631,7 +631,7 @@ namespace cds { namespace intrusive { // Hack: convert node_type to value_type. // In principle, auxiliary node can be non-reducible to value_type // We assume that comparator can correctly distinguish aux and regular node. - return insert_at( pHead, *node_traits::to_value_ptr( pNode ) ); + return insert_at( pHead, *node_traits::to_value_ptr( pNode )); } bool insert_at( node_type * pHead, value_type& val ) @@ -644,7 +644,7 @@ namespace cds { namespace intrusive { { auto_lock_position alp( pos ); if ( validate( pos.pPred, pos.pCur )) { - if ( pos.pCur != &m_Tail && equal( *node_traits::to_value_ptr( *pos.pCur ), val, pred ) ) { + if ( pos.pCur != &m_Tail && equal( *node_traits::to_value_ptr( *pos.pCur ), val, pred )) { // failed: key already in list m_Stat.onInsertFailed(); return false; @@ -709,7 +709,7 @@ namespace cds { namespace intrusive { ++m_ItemCounter; m_Stat.onUpdateNew(); - return std::make_pair( iterator( node_traits::to_node_ptr( val ) ), true ); + return std::make_pair( iterator( node_traits::to_node_ptr( val )), true ); } template @@ -727,7 +727,7 @@ namespace cds { namespace intrusive { search( pHead, val, pos, pred ); if ( pos.pCur != &m_Tail ) { std::unique_lock< typename node_type::lock_type> al( pos.pCur->m_Lock ); - if ( equal( *node_traits::to_value_ptr( *pos.pCur ), val, pred ) ) + if ( equal( *node_traits::to_value_ptr( *pos.pCur ), val, pred )) { f( *node_traits::to_value_ptr( *pos.pCur ), val ); m_Stat.onFindSuccess(); @@ -743,7 +743,7 @@ namespace cds { namespace intrusive { value_type * find_at( node_type * pHead, Q& val, Pred pred) { iterator it = find_at_( pHead, val, pred ); - if ( it != end() ) + if ( it != end()) return &*it; return nullptr; } @@ -777,7 +777,7 @@ namespace cds { namespace intrusive { node_type * pCur = pHead; node_type * pPrev = pHead; - while ( pCur != pTail && ( pCur == pHead || !equal( *node_traits::to_value_ptr( *pCur ), key, eq ) )) { + while ( pCur != pTail && ( pCur == pHead || !equal( *node_traits::to_value_ptr( *pCur ), key, eq ))) { pPrev = pCur; pCur = pCur->m_pNext.load(memory_model::memory_order_acquire); } @@ -838,7 +838,7 @@ namespace cds { namespace intrusive { if ( pred( *node_traits::to_value_ptr( pHead ))) { assert( pPred != nullptr ); pPred->m_pNext.store( p, memory_model::memory_order_relaxed ); - dispose_node( pHead, disposer() ); + dispose_node( pHead, disposer()); } else pPred = pHead; diff --git a/cds/intrusive/lazy_list_rcu.h b/cds/intrusive/lazy_list_rcu.h index 3e9483c2..10be3213 100644 --- a/cds/intrusive/lazy_list_rcu.h +++ b/cds/intrusive/lazy_list_rcu.h @@ -854,9 +854,9 @@ namespace cds { namespace intrusive { static void dispose_node( node_type * pNode ) { assert( pNode ); - assert( !gc::is_locked() ); + assert( !gc::is_locked()); - gc::template retire_ptr( node_traits::to_value_ptr( *pNode ) ); + gc::template retire_ptr( node_traits::to_value_ptr( *pNode )); } static void link_node( node_type * pNode, node_type * pPred, node_type * pCur ) @@ -1183,7 +1183,7 @@ namespace cds { namespace intrusive { bool validate( node_type * pPred, node_type * pCur ) CDS_NOEXCEPT { - if ( validate_link( pPred, pCur ) ) { + if ( validate_link( pPred, pCur )) { m_Stat.onValidationSuccess(); return true; } @@ -1287,13 +1287,13 @@ namespace cds { namespace intrusive { //@cond const_iterator get_const_begin() const { - const_iterator it( const_cast(&m_Head) ); + const_iterator it( const_cast(&m_Head)); ++it; // skip dummy head return it; } const_iterator get_const_end() const { - return const_iterator( const_cast(&m_Tail) ); + return const_iterator( const_cast(&m_Tail)); } //@endcond }; diff --git a/cds/intrusive/michael_list_nogc.h b/cds/intrusive/michael_list_nogc.h index 90455a28..3cf21e23 100644 --- a/cds/intrusive/michael_list_nogc.h +++ b/cds/intrusive/michael_list_nogc.h @@ -274,7 +274,7 @@ namespace cds { namespace intrusive { */ iterator begin() { - return iterator(m_pHead.load(memory_model::memory_order_relaxed) ); + return iterator(m_pHead.load(memory_model::memory_order_relaxed)); } /// Returns an iterator that addresses the location succeeding the last element in a list @@ -293,12 +293,12 @@ namespace cds { namespace intrusive { /// Returns a forward const iterator addressing the first element in a list const_iterator begin() const { - return const_iterator(m_pHead.load(memory_model::memory_order_relaxed) ); + return const_iterator(m_pHead.load(memory_model::memory_order_relaxed)); } /// Returns a forward const iterator addressing the first element in a list const_iterator cbegin() const { - return const_iterator(m_pHead.load(memory_model::memory_order_relaxed) ); + return const_iterator(m_pHead.load(memory_model::memory_order_relaxed)); } /// Returns an const iterator that addresses the location succeeding the last element in a list @@ -446,7 +446,7 @@ namespace cds { namespace intrusive { template value_type * contains( Q const& key ) { - return find_at( m_pHead, key, key_comparator() ); + return find_at( m_pHead, key, key_comparator()); } //@cond template @@ -504,7 +504,7 @@ namespace cds { namespace intrusive { */ void clear() { - clear( disposer() ); + clear( disposer()); } /// Checks if the list is empty @@ -548,7 +548,7 @@ namespace cds { namespace intrusive { // Hack: convert node_type to value_type. // In principle, auxiliary node can be non-reducible to value_type // We assume that comparator can correctly distinguish aux and regular node. - return insert_at( refHead, *node_traits::to_value_ptr( pNode ) ); + return insert_at( refHead, *node_traits::to_value_ptr( pNode )); } bool insert_at( atomic_node_ptr& refHead, value_type& val ) @@ -561,7 +561,7 @@ namespace cds { namespace intrusive { return false; } - if ( link_node( node_traits::to_node_ptr( val ), pos ) ) { + if ( link_node( node_traits::to_node_ptr( val ), pos )) { ++m_ItemCounter; m_Stat.onInsertSuccess(); return true; @@ -584,8 +584,8 @@ namespace cds { namespace intrusive { position pos; while ( true ) { - if ( search( refHead, val, key_comparator(), pos ) ) { - assert( key_comparator()( val, *node_traits::to_value_ptr( *pos.pCur ) ) == 0 ); + if ( search( refHead, val, key_comparator(), pos )) { + assert( key_comparator()( val, *node_traits::to_value_ptr( *pos.pCur )) == 0 ); func( false, *node_traits::to_value_ptr( *pos.pCur ) , val ); m_Stat.onUpdateExisting(); @@ -597,7 +597,7 @@ namespace cds { namespace intrusive { return std::make_pair( end(), false ); } - if ( link_node( node_traits::to_node_ptr( val ), pos ) ) { + if ( link_node( node_traits::to_node_ptr( val ), pos )) { ++m_ItemCounter; func( true, val , val ); m_Stat.onUpdateNew(); @@ -621,7 +621,7 @@ namespace cds { namespace intrusive { { position pos; - if ( search( refHead, val, cmp, pos ) ) { + if ( search( refHead, val, cmp, pos )) { assert( pos.pCur != nullptr ); f( *node_traits::to_value_ptr( *pos.pCur ), val ); m_Stat.onFindSuccess(); @@ -636,7 +636,7 @@ namespace cds { namespace intrusive { value_type * find_at( atomic_node_ptr& refHead, Q const& val, Compare cmp ) { iterator it = find_at_( refHead, val, cmp ); - if ( it != end() ) { + if ( it != end()) { m_Stat.onFindSuccess(); return &*it; } @@ -650,7 +650,7 @@ namespace cds { namespace intrusive { { position pos; - if ( search( refHead, val, cmp, pos ) ) { + if ( search( refHead, val, cmp, pos )) { assert( pos.pCur != nullptr ); m_Stat.onFindSuccess(); return iterator( pos.pCur ); diff --git a/cds/intrusive/michael_list_rcu.h b/cds/intrusive/michael_list_rcu.h index 7fbc68e6..3f3422da 100644 --- a/cds/intrusive/michael_list_rcu.h +++ b/cds/intrusive/michael_list_rcu.h @@ -506,7 +506,7 @@ namespace cds { namespace intrusive { template bool erase( Q const& key ) { - return erase_at( m_pHead, key, key_comparator() ); + return erase_at( m_pHead, key, key_comparator()); } /// Deletes the item from the list using \p pred predicate for searching @@ -522,7 +522,7 @@ namespace cds { namespace intrusive { bool erase_with( Q const& key, Less pred ) { CDS_UNUSED( pred ); - return erase_at( m_pHead, key, cds::opt::details::make_comparator_from_less() ); + return erase_at( m_pHead, key, cds::opt::details::make_comparator_from_less()); } /// Deletes the item from the list @@ -592,7 +592,7 @@ namespace cds { namespace intrusive { rcu_michael_list::exempt_ptr p1; // The RCU should NOT be locked when extract() is called! - assert( !rcu::is_locked() ); + assert( !rcu::is_locked()); // You can call extract() function p1 = theList.extract( 10 ); @@ -610,7 +610,7 @@ namespace cds { namespace intrusive { template exempt_ptr extract( Q const& key ) { - return exempt_ptr( extract_at( m_pHead, key, key_comparator() )); + return exempt_ptr( extract_at( m_pHead, key, key_comparator())); } /// Extracts an item from the list using \p pred predicate for searching @@ -625,7 +625,7 @@ namespace cds { namespace intrusive { exempt_ptr extract_with( Q const& key, Less pred ) { CDS_UNUSED( pred ); - return exempt_ptr( extract_at( m_pHead, key, cds::opt::details::make_comparator_from_less() )); + return exempt_ptr( extract_at( m_pHead, key, cds::opt::details::make_comparator_from_less())); } /// Find the key \p val @@ -691,7 +691,7 @@ namespace cds { namespace intrusive { template bool contains( Q const& key ) { - return find_at( m_pHead, key, key_comparator() ); + return find_at( m_pHead, key, key_comparator()); } //@cond template @@ -712,7 +712,7 @@ namespace cds { namespace intrusive { bool contains( Q const& key, Less pred ) { CDS_UNUSED( pred ); - return find_at( m_pHead, key, cds::opt::details::make_comparator_from_less() ); + return find_at( m_pHead, key, cds::opt::details::make_comparator_from_less()); } //@cond template @@ -787,7 +787,7 @@ namespace cds { namespace intrusive { */ void clear() { - if( !empty() ) { + if( !empty()) { check_deadlock_policy::check(); marked_node_ptr pHead; @@ -795,9 +795,9 @@ namespace cds { namespace intrusive { { rcu_lock l; pHead = m_pHead.load(memory_model::memory_order_acquire); - if ( !pHead.ptr() ) + if ( !pHead.ptr()) break; - marked_node_ptr pNext( pHead->m_pNext.load(memory_model::memory_order_relaxed) ); + marked_node_ptr pNext( pHead->m_pNext.load(memory_model::memory_order_relaxed)); if ( cds_unlikely( !pHead->m_pNext.compare_exchange_weak( pNext, pNext | 1, memory_model::memory_order_acquire, memory_model::memory_order_relaxed ))) continue; if ( cds_unlikely( !m_pHead.compare_exchange_weak( pHead, marked_node_ptr(pNext.ptr()), memory_model::memory_order_release, memory_model::memory_order_relaxed ))) @@ -805,7 +805,7 @@ namespace cds { namespace intrusive { } --m_ItemCounter; - dispose_node( pHead.ptr() ); + dispose_node( pHead.ptr()); } } } @@ -846,25 +846,25 @@ namespace cds { namespace intrusive { static void dispose_node( node_type * pNode ) { assert( pNode ); - assert( !gc::is_locked() ); + assert( !gc::is_locked()); - gc::template retire_ptr( node_traits::to_value_ptr( *pNode ) ); + gc::template retire_ptr( node_traits::to_value_ptr( *pNode )); } static void dispose_chain( node_type * pChain ) { if ( pChain ) { - assert( !gc::is_locked() ); + assert( !gc::is_locked()); auto f = [&pChain]() -> cds::urcu::retired_ptr { node_type * p = pChain; if ( p ) { pChain = p->m_pDelChain; - return cds::urcu::make_retired_ptr( node_traits::to_value_ptr( p ) ); + return cds::urcu::make_retired_ptr( node_traits::to_value_ptr( p )); } - return cds::urcu::make_retired_ptr( static_cast(nullptr) ); + return cds::urcu::make_retired_ptr( static_cast(nullptr)); }; - gc::batch_retire( std::ref( f ) ); + gc::batch_retire( std::ref( f )); } } @@ -875,7 +875,7 @@ namespace cds { namespace intrusive { marked_node_ptr p( pos.pCur ); pNode->m_pNext.store( p, memory_model::memory_order_release ); - if ( cds_likely( pos.pPrev->compare_exchange_strong( p, marked_node_ptr( pNode ), memory_model::memory_order_release, atomics::memory_order_relaxed ) ) ) + if ( cds_likely( pos.pPrev->compare_exchange_strong( p, marked_node_ptr( pNode ), memory_model::memory_order_release, atomics::memory_order_relaxed )) ) return true; pNode->m_pNext.store( marked_node_ptr(), memory_model::memory_order_relaxed ); @@ -892,22 +892,22 @@ namespace cds { namespace intrusive { bool unlink_node( position& pos, erase_node_mask nMask ) { - assert( gc::is_locked() ); + assert( gc::is_locked()); // Mark the node (logical deletion) marked_node_ptr next( pos.pNext, 0 ); - if ( cds_likely( pos.pCur->m_pNext.compare_exchange_strong( next, next | nMask, memory_model::memory_order_release, atomics::memory_order_relaxed ) ) ) { + if ( cds_likely( pos.pCur->m_pNext.compare_exchange_strong( next, next | nMask, memory_model::memory_order_release, atomics::memory_order_relaxed )) ) { // Try physical removal - fast path marked_node_ptr cur( pos.pCur ); - if ( cds_likely( pos.pPrev->compare_exchange_strong( cur, marked_node_ptr( pos.pNext ), memory_model::memory_order_acquire, atomics::memory_order_relaxed ) ) ) { + if ( cds_likely( pos.pPrev->compare_exchange_strong( cur, marked_node_ptr( pos.pNext ), memory_model::memory_order_acquire, atomics::memory_order_relaxed )) ) { if ( nMask == erase_mask ) link_to_remove_chain( pos, pos.pCur ); } else { // Slow path - search( pos.refHead, *node_traits::to_value_ptr( pos.pCur ), pos, key_comparator() ); + search( pos.refHead, *node_traits::to_value_ptr( pos.pCur ), pos, key_comparator()); } return true; } @@ -928,7 +928,7 @@ namespace cds { namespace intrusive { // Hack: convert node_type to value_type. // In principle, auxiliary node can be non-reducible to value_type // We assume that comparator can correctly distinguish between aux and regular node. - return insert_at( refHead, *node_traits::to_value_ptr( pNode ) ); + return insert_at( refHead, *node_traits::to_value_ptr( pNode )); } bool insert_at( atomic_node_ptr& refHead, value_type& val ) @@ -953,7 +953,7 @@ namespace cds { namespace intrusive { return false; } - if ( link_node( node_traits::to_node_ptr( val ), pos ) ) { + if ( link_node( node_traits::to_node_ptr( val ), pos )) { f( val ); ++m_ItemCounter; m_Stat.onInsertSuccess(); @@ -1006,7 +1006,7 @@ namespace cds { namespace intrusive { for (;;) { { rcu_lock l; - if ( !search( refHead, val, pos, key_comparator() ) || node_traits::to_value_ptr( *pos.pCur ) != &val ) { + if ( !search( refHead, val, pos, key_comparator()) || node_traits::to_value_ptr( *pos.pCur ) != &val ) { m_Stat.onEraseFailed(); return false; } @@ -1033,7 +1033,7 @@ namespace cds { namespace intrusive { for (;;) { { rcu_lock l; - if ( !search( pos.refHead, val, pos, cmp ) ) { + if ( !search( pos.refHead, val, pos, cmp )) { m_Stat.onEraseFailed(); return false; } @@ -1047,7 +1047,7 @@ namespace cds { namespace intrusive { } } assert( pDel ); - f( *node_traits::to_value_ptr( pDel ) ); + f( *node_traits::to_value_ptr( pDel )); --m_ItemCounter; m_Stat.onEraseSuccess(); return true; @@ -1073,7 +1073,7 @@ namespace cds { namespace intrusive { { position pos( refHead ); back_off bkoff; - assert( !gc::is_locked() ) ; // RCU must not be locked!!! + assert( !gc::is_locked()) ; // RCU must not be locked!!! node_type * pExtracted; { @@ -1108,7 +1108,7 @@ namespace cds { namespace intrusive { { rcu_lock l; - if ( search( refHead, val, pos, cmp ) ) { + if ( search( refHead, val, pos, cmp )) { assert( pos.pCur != nullptr ); f( *node_traits::to_value_ptr( *pos.pCur ), val ); m_Stat.onFindSuccess(); @@ -1134,7 +1134,7 @@ namespace cds { namespace intrusive { raw_ptr get_at( atomic_node_ptr& refHead, Q const& val, Compare cmp ) { // RCU should be locked! - assert(gc::is_locked() ); + assert(gc::is_locked()); position pos( refHead ); @@ -1155,7 +1155,7 @@ namespace cds { namespace intrusive { bool search( atomic_node_ptr& refHead, const Q& val, position& pos, Compare cmp ) { // RCU lock should be locked!!! - assert( gc::is_locked() ); + assert( gc::is_locked()); atomic_node_ptr * pPrev; marked_node_ptr pNext; @@ -1169,7 +1169,7 @@ namespace cds { namespace intrusive { pNext = nullptr; while ( true ) { - if ( !pCur.ptr() ) { + if ( !pCur.ptr()) { pos.pPrev = pPrev; pos.pCur = nullptr; pos.pNext = nullptr; @@ -1185,11 +1185,11 @@ namespace cds { namespace intrusive { goto try_again; } - if ( pNext.bits() ) { + if ( pNext.bits()) { // pCur is marked as deleted. Try to unlink it from the list - if ( cds_likely( pPrev->compare_exchange_weak( pCur, marked_node_ptr( pNext.ptr() ), memory_model::memory_order_acquire, atomics::memory_order_relaxed ))) { + if ( cds_likely( pPrev->compare_exchange_weak( pCur, marked_node_ptr( pNext.ptr()), memory_model::memory_order_acquire, atomics::memory_order_relaxed ))) { if ( pNext.bits() == erase_mask ) - link_to_remove_chain( pos, pCur.ptr() ); + link_to_remove_chain( pos, pCur.ptr()); m_Stat.onHelpingSuccess(); } @@ -1198,7 +1198,7 @@ namespace cds { namespace intrusive { } assert( pCur.ptr() != nullptr ); - int nCmp = cmp( *node_traits::to_value_ptr( pCur.ptr() ), val ); + int nCmp = cmp( *node_traits::to_value_ptr( pCur.ptr()), val ); if ( nCmp >= 0 ) { pos.pPrev = pPrev; pos.pCur = pCur.ptr(); @@ -1216,15 +1216,15 @@ namespace cds { namespace intrusive { bool insert_at_locked( position& pos, value_type& val ) { // RCU lock should be locked!!! - assert( gc::is_locked() ); + assert( gc::is_locked()); while ( true ) { - if ( search( pos.refHead, val, pos, key_comparator() )) { + if ( search( pos.refHead, val, pos, key_comparator())) { m_Stat.onInsertFailed(); return false; } - if ( link_node( node_traits::to_node_ptr( val ), pos ) ) { + if ( link_node( node_traits::to_node_ptr( val ), pos )) { ++m_ItemCounter; m_Stat.onInsertSuccess(); return true; @@ -1240,11 +1240,11 @@ namespace cds { namespace intrusive { std::pair update_at_locked( position& pos, value_type& val, Func func, bool bInsert ) { // RCU should be locked!!! - assert( gc::is_locked() ); + assert( gc::is_locked()); while ( true ) { - if ( search( pos.refHead, val, pos, key_comparator() ) ) { - assert( key_comparator()( val, *node_traits::to_value_ptr( *pos.pCur ) ) == 0 ); + if ( search( pos.refHead, val, pos, key_comparator()) ) { + assert( key_comparator()( val, *node_traits::to_value_ptr( *pos.pCur )) == 0 ); func( false, *node_traits::to_value_ptr( *pos.pCur ), val ); m_Stat.onUpdateExisting(); @@ -1256,7 +1256,7 @@ namespace cds { namespace intrusive { return std::make_pair( end(), false ); } - if ( link_node( node_traits::to_node_ptr( val ), pos ) ) { + if ( link_node( node_traits::to_node_ptr( val ), pos )) { ++m_ItemCounter; func( true, val , val ); m_Stat.onUpdateNew(); @@ -1273,9 +1273,9 @@ namespace cds { namespace intrusive { template const_iterator find_at_locked( position& pos, Q const& val, Compare cmp ) { - assert( gc::is_locked() ); + assert( gc::is_locked()); - if ( search( pos.refHead, val, pos, cmp ) ) { + if ( search( pos.refHead, val, pos, cmp )) { assert( pos.pCur != nullptr ); m_Stat.onFindSuccess(); return const_iterator( pos.pCur ); diff --git a/cds/intrusive/michael_set.h b/cds/intrusive/michael_set.h index d6185704..63a3dccd 100644 --- a/cds/intrusive/michael_set.h +++ b/cds/intrusive/michael_set.h @@ -333,7 +333,7 @@ namespace cds { namespace intrusive { */ iterator begin() { - return iterator( m_Buckets[0].begin(), bucket_begin(), bucket_end() ); + return iterator( m_Buckets[0].begin(), bucket_begin(), bucket_end()); } /// Returns an iterator that addresses the location succeeding the last element in a set @@ -344,7 +344,7 @@ namespace cds { namespace intrusive { */ iterator end() { - return iterator( bucket_end()[-1].end(), bucket_end() - 1, bucket_end() ); + return iterator( bucket_end()[-1].end(), bucket_end() - 1, bucket_end()); } /// Returns a forward const iterator addressing the first element in a set @@ -398,7 +398,7 @@ namespace cds { namespace intrusive { for ( auto it = m_Buckets, itEnd = m_Buckets + bucket_count(); it != itEnd; ++it ) it->~internal_bucket_type(); - bucket_table_allocator().deallocate( m_Buckets, bucket_count() ); + bucket_table_allocator().deallocate( m_Buckets, bucket_count()); } /// Inserts new node @@ -733,7 +733,7 @@ namespace cds { namespace intrusive { { internal_bucket_type& b = bucket( key ); typename internal_bucket_type::iterator it = b.find( key ); - if ( it == b.end() ) + if ( it == b.end()) return end(); return iterator( it, &b, bucket_end()); } @@ -744,9 +744,9 @@ namespace cds { namespace intrusive { { internal_bucket_type& b = bucket( key ); typename internal_bucket_type::iterator it = b.find( key ); - if ( it == b.end() ) + if ( it == b.end()) return end(); - return iterator( it, &b, bucket_end() ); + return iterator( it, &b, bucket_end()); } //@endcond @@ -791,9 +791,9 @@ namespace cds { namespace intrusive { { internal_bucket_type& b = bucket( key ); typename internal_bucket_type::iterator it = b.find_with( key, pred ); - if ( it == b.end() ) + if ( it == b.end()) return end(); - return iterator( it, &b, bucket_end() ); + return iterator( it, &b, bucket_end()); } //@cond template @@ -802,9 +802,9 @@ namespace cds { namespace intrusive { { internal_bucket_type& b = bucket( key ); typename internal_bucket_type::iterator it = b.find_with( key, pred ); - if ( it == b.end() ) + if ( it == b.end()) return end(); - return iterator( it, &b, bucket_end() ); + return iterator( it, &b, bucket_end()); } //@endcond @@ -946,11 +946,11 @@ namespace cds { namespace intrusive { const_iterator get_const_begin() const { - return const_iterator( m_Buckets[0].cbegin(), bucket_begin(), bucket_end() ); + return const_iterator( m_Buckets[0].cbegin(), bucket_begin(), bucket_end()); } const_iterator get_const_end() const { - return const_iterator( bucket_end()[-1].cend(), bucket_end() - 1, bucket_end() ); + return const_iterator( bucket_end()[-1].cend(), bucket_end() - 1, bucket_end()); } template diff --git a/cds/intrusive/michael_set_nogc.h b/cds/intrusive/michael_set_nogc.h index 44b946b6..9aeb8468 100644 --- a/cds/intrusive/michael_set_nogc.h +++ b/cds/intrusive/michael_set_nogc.h @@ -175,7 +175,7 @@ namespace cds { namespace intrusive { */ iterator begin() { - return iterator( m_Buckets[0].begin(), m_Buckets, m_Buckets + bucket_count() ); + return iterator( m_Buckets[0].begin(), m_Buckets, m_Buckets + bucket_count()); } /// Returns an iterator that addresses the location succeeding the last element in a set @@ -186,7 +186,7 @@ namespace cds { namespace intrusive { */ iterator end() { - return iterator( m_Buckets[bucket_count() - 1].end(), m_Buckets + bucket_count() - 1, m_Buckets + bucket_count() ); + return iterator( m_Buckets[bucket_count() - 1].end(), m_Buckets + bucket_count() - 1, m_Buckets + bucket_count()); } /// Returns a forward const iterator addressing the first element in a set @@ -197,7 +197,7 @@ namespace cds { namespace intrusive { /// Returns a forward const iterator addressing the first element in a set const_iterator cbegin() const { - return const_iterator( m_Buckets[0].cbegin(), m_Buckets, m_Buckets + bucket_count() ); + return const_iterator( m_Buckets[0].cbegin(), m_Buckets, m_Buckets + bucket_count()); } /// Returns an const iterator that addresses the location succeeding the last element in a set @@ -208,7 +208,7 @@ namespace cds { namespace intrusive { /// Returns an const iterator that addresses the location succeeding the last element in a set const_iterator cend() const { - return const_iterator( m_Buckets[bucket_count() - 1].cend(), m_Buckets + bucket_count() - 1, m_Buckets + bucket_count() ); + return const_iterator( m_Buckets[bucket_count() - 1].cend(), m_Buckets + bucket_count() - 1, m_Buckets + bucket_count()); } //@} @@ -225,7 +225,7 @@ namespace cds { namespace intrusive { size_t nMaxItemCount, ///< estimation of max item count in the hash set size_t nLoadFactor ///< load factor: estimation of max number of items in the bucket ) : m_nHashBitmask( michael_set::details::init_hash_bitmask( nMaxItemCount, nLoadFactor )) - , m_Buckets( bucket_table_allocator().allocate( bucket_count() ) ) + , m_Buckets( bucket_table_allocator().allocate( bucket_count()) ) { for ( auto it = m_Buckets, itEnd = m_Buckets + bucket_count(); it != itEnd; ++it ) construct_bucket( it ); @@ -238,7 +238,7 @@ namespace cds { namespace intrusive { for ( auto it = m_Buckets, itEnd = m_Buckets + bucket_count(); it != itEnd; ++it ) it->~internal_bucket_type(); - bucket_table_allocator().deallocate( m_Buckets, bucket_count() ); + bucket_table_allocator().deallocate( m_Buckets, bucket_count()); } /// Inserts new node diff --git a/cds/intrusive/michael_set_rcu.h b/cds/intrusive/michael_set_rcu.h index 52c420e2..ab80e74e 100644 --- a/cds/intrusive/michael_set_rcu.h +++ b/cds/intrusive/michael_set_rcu.h @@ -211,7 +211,7 @@ namespace cds { namespace intrusive { */ iterator begin() { - return iterator( m_Buckets[0].begin(), m_Buckets, m_Buckets + bucket_count() ); + return iterator( m_Buckets[0].begin(), m_Buckets, m_Buckets + bucket_count()); } /// Returns an iterator that addresses the location succeeding the last element in a set @@ -222,7 +222,7 @@ namespace cds { namespace intrusive { */ iterator end() { - return iterator( m_Buckets[bucket_count() - 1].end(), m_Buckets + bucket_count() - 1, m_Buckets + bucket_count() ); + return iterator( m_Buckets[bucket_count() - 1].end(), m_Buckets + bucket_count() - 1, m_Buckets + bucket_count()); } /// Returns a forward const iterator addressing the first element in a set @@ -234,7 +234,7 @@ namespace cds { namespace intrusive { /// Returns a forward const iterator addressing the first element in a set const_iterator cbegin() const { - return const_iterator( m_Buckets[0].cbegin(), m_Buckets, m_Buckets + bucket_count() ); + return const_iterator( m_Buckets[0].cbegin(), m_Buckets, m_Buckets + bucket_count()); } /// Returns an const iterator that addresses the location succeeding the last element in a set @@ -246,7 +246,7 @@ namespace cds { namespace intrusive { /// Returns an const iterator that addresses the location succeeding the last element in a set const_iterator cend() const { - return const_iterator( m_Buckets[bucket_count() - 1].cend(), m_Buckets + bucket_count() - 1, m_Buckets + bucket_count() ); + return const_iterator( m_Buckets[bucket_count() - 1].cend(), m_Buckets + bucket_count() - 1, m_Buckets + bucket_count()); } //@} @@ -263,7 +263,7 @@ namespace cds { namespace intrusive { size_t nMaxItemCount, ///< estimation of max item count in the hash set size_t nLoadFactor ///< load factor: average size of the bucket ) : m_nHashBitmask( michael_set::details::init_hash_bitmask( nMaxItemCount, nLoadFactor )) - , m_Buckets( bucket_table_allocator().allocate( bucket_count() ) ) + , m_Buckets( bucket_table_allocator().allocate( bucket_count()) ) { for ( auto it = m_Buckets, itEnd = m_Buckets + bucket_count(); it != itEnd; ++it ) construct_bucket( it ); @@ -276,7 +276,7 @@ namespace cds { namespace intrusive { for ( auto it = m_Buckets, itEnd = m_Buckets + bucket_count(); it != itEnd; ++it ) it->~internal_bucket_type(); - bucket_table_allocator().deallocate( m_Buckets, bucket_count() ); + bucket_table_allocator().deallocate( m_Buckets, bucket_count()); } /// Inserts new node @@ -509,7 +509,7 @@ namespace cds { namespace intrusive { template exempt_ptr extract( Q const& key ) { - exempt_ptr p( bucket( key ).extract( key ) ); + exempt_ptr p( bucket( key ).extract( key )); if ( p ) --m_ItemCounter; return p; @@ -524,7 +524,7 @@ namespace cds { namespace intrusive { template exempt_ptr extract_with( Q const& key, Less pred ) { - exempt_ptr p( bucket( key ).extract_with( key, pred ) ); + exempt_ptr p( bucket( key ).extract_with( key, pred )); if ( p ) --m_ItemCounter; return p; diff --git a/cds/intrusive/mspriority_queue.h b/cds/intrusive/mspriority_queue.h index 5b43b465..d79e6026 100644 --- a/cds/intrusive/mspriority_queue.h +++ b/cds/intrusive/mspriority_queue.h @@ -223,7 +223,7 @@ namespace cds { namespace intrusive { /// Creates empty node node() : m_pVal( nullptr ) - , m_nTag( tag_type(Empty) ) + , m_nTag( tag_type(Empty)) {} /// Lock the node @@ -283,7 +283,7 @@ namespace cds { namespace intrusive { // Insert new item at bottom of the heap m_Lock.lock(); - if ( m_ItemCounter.value() >= capacity() ) { + if ( m_ItemCounter.value() >= capacity()) { // the heap is full m_Lock.unlock(); m_Stat.onPushFailed(); @@ -291,7 +291,7 @@ namespace cds { namespace intrusive { } counter_type i = m_ItemCounter.inc(); - assert( i < m_Heap.capacity() ); + assert( i < m_Heap.capacity()); node& refNode = m_Heap[i]; refNode.lock(); @@ -326,7 +326,7 @@ namespace cds { namespace intrusive { return nullptr; } counter_type nBottom = m_ItemCounter.dec(); - assert( nBottom < m_Heap.capacity() ); + assert( nBottom < m_Heap.capacity()); assert( nBottom > 0 ); refTop.lock(); @@ -348,7 +348,7 @@ namespace cds { namespace intrusive { refBottom.m_pVal = nullptr; refBottom.unlock(); - if ( refTop.m_nTag == tag_type(Empty) ) { + if ( refTop.m_nTag == tag_type(Empty)) { // nBottom == nTop refTop.unlock(); m_Stat.onPopSuccess(); @@ -457,7 +457,7 @@ namespace cds { namespace intrusive { i = 0; } } - else if ( refParent.m_nTag == tag_type( Empty ) ) { + else if ( refParent.m_nTag == tag_type( Empty )) { m_Stat.onItemMovedTop(); i = 0; } diff --git a/cds/intrusive/msqueue.h b/cds/intrusive/msqueue.h index 5eafbba3..240124cd 100644 --- a/cds/intrusive/msqueue.h +++ b/cds/intrusive/msqueue.h @@ -456,13 +456,13 @@ namespace cds { namespace intrusive { void operator()( value_type * p ) const { assert( p != nullptr ); - MSQueue::clear_links( node_traits::to_node_ptr( p ) ); + MSQueue::clear_links( node_traits::to_node_ptr( p )); disposer()(p); } }; if ( p != &m_Dummy ) - gc::template retire( node_traits::to_value_ptr( p ) ); + gc::template retire( node_traits::to_value_ptr( p )); } //@endcond @@ -485,7 +485,7 @@ namespace cds { namespace intrusive { node_type * pHead = m_pHead.load(memory_model::memory_order_relaxed); assert( pHead != nullptr ); - assert( pHead == m_pTail.load(memory_model::memory_order_relaxed) ); + assert( pHead == m_pTail.load(memory_model::memory_order_relaxed)); m_pHead.store( nullptr, memory_model::memory_order_relaxed ); m_pTail.store( nullptr, memory_model::memory_order_relaxed ); @@ -596,7 +596,7 @@ namespace cds { namespace intrusive { */ void clear() { - while ( dequeue() ); + while ( dequeue()); } /// Returns queue's item count diff --git a/cds/intrusive/optimistic_queue.h b/cds/intrusive/optimistic_queue.h index c30ad17f..c8bd065a 100644 --- a/cds/intrusive/optimistic_queue.h +++ b/cds/intrusive/optimistic_queue.h @@ -570,11 +570,11 @@ namespace cds { namespace intrusive { { assert( p != nullptr ); - OptimisticQueue::clear_links( node_traits::to_node_ptr( *p ) ); + OptimisticQueue::clear_links( node_traits::to_node_ptr( *p )); disposer()(p); } }; - gc::template retire( node_traits::to_value_ptr(p) ); + gc::template retire( node_traits::to_value_ptr(p)); } } diff --git a/cds/intrusive/segmented_queue.h b/cds/intrusive/segmented_queue.h index 97c2a4a2..a463751f 100644 --- a/cds/intrusive/segmented_queue.h +++ b/cds/intrusive/segmented_queue.h @@ -324,7 +324,7 @@ namespace cds { namespace intrusive { ~segment_list() { - m_List.clear_and_dispose( gc_segment_disposer() ); + m_List.clear_and_dispose( gc_segment_disposer()); } segment * head( typename gc::Guard& guard ) @@ -343,7 +343,7 @@ namespace cds { namespace intrusive { // The lock should be held cell const * pLastCell = s.cells + quasi_factor(); for ( cell const * pCell = s.cells; pCell < pLastCell; ++pCell ) { - if ( !pCell->data.load( memory_model::memory_order_relaxed ).all() ) + if ( !pCell->data.load( memory_model::memory_order_relaxed ).all()) return false; } return true; @@ -353,7 +353,7 @@ namespace cds { namespace intrusive { // The lock should be held cell const * pLastCell = s.cells + quasi_factor(); for ( cell const * pCell = s.cells; pCell < pLastCell; ++pCell ) { - if ( !pCell->data.load( memory_model::memory_order_relaxed ).bits() ) + if ( !pCell->data.load( memory_model::memory_order_relaxed ).bits()) return false; } return true; @@ -371,17 +371,17 @@ namespace cds { namespace intrusive { if ( !m_List.empty() && ( pTail != &m_List.back() || get_version(pTail) != m_List.back().version )) { m_pTail.store( &m_List.back(), memory_model::memory_order_relaxed ); - return guard.assign( &m_List.back() ); + return guard.assign( &m_List.back()); } # ifdef _DEBUG - assert( m_List.empty() || populated( m_List.back() )); + assert( m_List.empty() || populated( m_List.back())); # endif segment * pNew = allocate_segment(); m_Stat.onSegmentCreated(); - if ( m_List.empty() ) + if ( m_List.empty()) m_pHead.store( pNew, memory_model::memory_order_release ); m_List.push_back( *pNew ); m_pTail.store( pNew, memory_model::memory_order_release ); @@ -397,7 +397,7 @@ namespace cds { namespace intrusive { { scoped_lock l( m_Lock ); - if ( m_List.empty() ) { + if ( m_List.empty()) { m_pTail.store( nullptr, memory_model::memory_order_relaxed ); m_pHead.store( nullptr, memory_model::memory_order_relaxed ); return guard.assign( nullptr ); @@ -405,7 +405,7 @@ namespace cds { namespace intrusive { if ( pHead != &m_List.front() || get_version(pHead) != m_List.front().version ) { m_pHead.store( &m_List.front(), memory_model::memory_order_relaxed ); - return guard.assign( &m_List.front() ); + return guard.assign( &m_List.front()); } # ifdef _DEBUG @@ -413,12 +413,12 @@ namespace cds { namespace intrusive { # endif m_List.pop_front(); - if ( m_List.empty() ) { + if ( m_List.empty()) { pRet = guard.assign( nullptr ); m_pTail.store( nullptr, memory_model::memory_order_relaxed ); } else - pRet = guard.assign( &m_List.front() ); + pRet = guard.assign( &m_List.front()); m_pHead.store( pRet, memory_model::memory_order_release ); } @@ -443,7 +443,7 @@ namespace cds { namespace intrusive { segment * allocate_segment() { - return segment_allocator().NewBlock( sizeof(segment) + sizeof(cell) * m_nQuasiFactor, quasi_factor() ); + return segment_allocator().NewBlock( sizeof(segment) + sizeof(cell) * m_nQuasiFactor, quasi_factor()); } static void free_segment( segment * pSegment ) @@ -497,7 +497,7 @@ namespace cds { namespace intrusive { assert( pTailSegment ); } - permutation_generator gen( quasi_factor() ); + permutation_generator gen( quasi_factor()); // First, increment item counter. // We sure that the item will be enqueued @@ -510,7 +510,7 @@ namespace cds { namespace intrusive { do { typename permutation_generator::integer_type i = gen; CDS_DEBUG_ONLY( ++nLoopCount ); - if ( pTailSegment->cells[i].data.load(memory_model::memory_order_relaxed).all() ) { + if ( pTailSegment->cells[i].data.load(memory_model::memory_order_relaxed).all()) { // Cell is not empty, go next m_Stat.onPushPopulated(); } @@ -524,10 +524,10 @@ namespace cds { namespace intrusive { m_Stat.onPush(); return true; } - assert( nullCell.ptr() ); + assert( nullCell.ptr()); m_Stat.onPushContended(); } - } while ( gen.next() ); + } while ( gen.next()); assert( nLoopCount == quasi_factor()); @@ -608,7 +608,7 @@ namespace cds { namespace intrusive { */ void clear() { - clear_with( disposer() ); + clear_with( disposer()); } /// Clear the queue @@ -620,9 +620,9 @@ namespace cds { namespace intrusive { void clear_with( Disposer ) { typename gc::Guard itemGuard; - while ( do_dequeue( itemGuard ) ) { - assert( itemGuard.template get() ); - gc::template retire( itemGuard.template get() ); + while ( do_dequeue( itemGuard )) { + assert( itemGuard.template get()); + gc::template retire( itemGuard.template get()); itemGuard.clear(); } } @@ -655,7 +655,7 @@ namespace cds { namespace intrusive { typename gc::Guard segmentGuard; segment * pHeadSegment = m_SegmentList.head( segmentGuard ); - permutation_generator gen( quasi_factor() ); + permutation_generator gen( quasi_factor()); while ( true ) { if ( !pHeadSegment ) { // Queue is empty @@ -674,15 +674,15 @@ namespace cds { namespace intrusive { // In segmented queue the cell cannot be reused // So no loop is needed here to protect the cell item = pHeadSegment->cells[i].data.load( memory_model::memory_order_relaxed ); - itemGuard.assign( item.ptr() ); + itemGuard.assign( item.ptr()); // Check if this cell is empty, which means an element // can be enqueued to this cell in the future - if ( !item.ptr() ) + if ( !item.ptr()) bHadNullValue = true; else { // If the item is not deleted yet - if ( !item.bits() ) { + if ( !item.bits()) { // Try to mark the cell as deleted if ( pHeadSegment->cells[i].data.compare_exchange_strong( item, item | 1, memory_model::memory_order_acquire, atomics::memory_order_relaxed )) @@ -692,13 +692,13 @@ namespace cds { namespace intrusive { return true; } - assert( item.bits() ); + assert( item.bits()); m_Stat.onPopContended(); } } - } while ( gen.next() ); + } while ( gen.next()); - assert( nLoopCount == quasi_factor() ); + assert( nLoopCount == quasi_factor()); // scanning the entire segment without finding a candidate to dequeue // If there was an empty cell, the queue is considered empty diff --git a/cds/intrusive/skip_list_nogc.h b/cds/intrusive/skip_list_nogc.h index a1d672e8..f3c7e735 100644 --- a/cds/intrusive/skip_list_nogc.h +++ b/cds/intrusive/skip_list_nogc.h @@ -93,8 +93,8 @@ namespace cds { namespace intrusive { /// Access to element of next pointer array atomic_ptr& next( unsigned int nLevel ) { - assert( nLevel < height() ); - assert( nLevel == 0 || (nLevel > 0 && m_arrNext != nullptr) ); + assert( nLevel < height()); + assert( nLevel == 0 || (nLevel > 0 && m_arrNext != nullptr)); return nLevel ? m_arrNext[ nLevel - 1] : m_pNext; } @@ -102,7 +102,7 @@ namespace cds { namespace intrusive { /// Access to element of next pointer array (const version) atomic_ptr const& next( unsigned int nLevel ) const { - assert( nLevel < height() ); + assert( nLevel < height()); assert( nLevel == 0 || nLevel > 0 && m_arrNext != nullptr ); return nLevel ? m_arrNext[ nLevel - 1] : m_pNext; @@ -165,7 +165,7 @@ namespace cds { namespace intrusive { public: // for internal use only!!! iterator( node_type& refHead ) - : m_pNode( refHead[0].load( atomics::memory_order_relaxed ) ) + : m_pNode( refHead[0].load( atomics::memory_order_relaxed )) {} static iterator from_node( node_type * pNode ) @@ -536,7 +536,7 @@ namespace cds { namespace intrusive { { node_type * p = pos.pSucc[0]; pNode->next( 0 ).store( pos.pSucc[ 0 ], memory_model::memory_order_release ); - if ( !pos.pPrev[0]->next(0).compare_exchange_strong( p, pNode, memory_model::memory_order_release, memory_model::memory_order_relaxed ) ) { + if ( !pos.pPrev[0]->next(0).compare_exchange_strong( p, pNode, memory_model::memory_order_release, memory_model::memory_order_relaxed )) { return false; } f( val ); @@ -549,7 +549,7 @@ namespace cds { namespace intrusive { if ( pNode->next( nLevel ).compare_exchange_strong( p, q, memory_model::memory_order_release, memory_model::memory_order_relaxed )) { p = q; - if ( pos.pPrev[nLevel]->next(nLevel).compare_exchange_strong( q, pNode, memory_model::memory_order_release, memory_model::memory_order_relaxed ) ) + if ( pos.pPrev[nLevel]->next(nLevel).compare_exchange_strong( q, pNode, memory_model::memory_order_release, memory_model::memory_order_relaxed )) break; } @@ -581,7 +581,7 @@ namespace cds { namespace intrusive { void increase_height( unsigned int nHeight ) { unsigned int nCur = m_nHeight.load( memory_model::memory_order_relaxed ); - while ( nCur < nHeight && !m_nHeight.compare_exchange_weak( nCur, nHeight, memory_model::memory_order_acquire, atomics::memory_order_relaxed ) ); + while ( nCur < nHeight && !m_nHeight.compare_exchange_weak( nCur, nHeight, memory_model::memory_order_acquire, atomics::memory_order_relaxed )); } //@endcond @@ -624,18 +624,18 @@ namespace cds { namespace intrusive { /// Returns a forward iterator addressing the first element in a set iterator begin() { - return iterator( *m_Head.head() ); + return iterator( *m_Head.head()); } /// Returns a forward const iterator addressing the first element in a set const_iterator begin() const { - return const_iterator( *m_Head.head() ); + return const_iterator( *m_Head.head()); } /// Returns a forward const iterator addressing the first element in a set const_iterator cbegin() const { - return const_iterator( *m_Head.head() ); + return const_iterator( *m_Head.head()); } /// Returns a forward iterator that addresses the location succeeding the last element in a set. diff --git a/cds/intrusive/skip_list_rcu.h b/cds/intrusive/skip_list_rcu.h index 82d4607c..c0722289 100644 --- a/cds/intrusive/skip_list_rcu.h +++ b/cds/intrusive/skip_list_rcu.h @@ -126,8 +126,8 @@ namespace cds { namespace intrusive { /// Access to element of next pointer array atomic_marked_ptr& next( unsigned int nLevel ) { - assert( nLevel < height() ); - assert( nLevel == 0 || (nLevel > 0 && m_arrNext != nullptr) ); + assert( nLevel < height()); + assert( nLevel == 0 || (nLevel > 0 && m_arrNext != nullptr)); # ifdef CDS_THREAD_SANITIZER_ENABLED // TSan false positive: m_arrNext is read-only array @@ -143,7 +143,7 @@ namespace cds { namespace intrusive { /// Access to element of next pointer array (const version) atomic_marked_ptr const& next( unsigned int nLevel ) const { - assert( nLevel < height() ); + assert( nLevel < height()); assert( nLevel == 0 || nLevel > 0 && m_arrNext != nullptr ); # ifdef CDS_THREAD_SANITIZER_ENABLED @@ -221,7 +221,7 @@ namespace cds { namespace intrusive { back_off bkoff; for (;;) { - if ( m_pNode->next( m_pNode->height() - 1 ).load( atomics::memory_order_acquire ).bits() ) { + if ( m_pNode->next( m_pNode->height() - 1 ).load( atomics::memory_order_acquire ).bits()) { // Current node is marked as deleted. So, its next pointer can point to anything // In this case we interrupt our iteration and returns end() iterator. *this = iterator(); @@ -230,12 +230,12 @@ namespace cds { namespace intrusive { marked_ptr p = m_pNode->next(0).load( atomics::memory_order_relaxed ); node_type * pp = p.ptr(); - if ( p.bits() ) { + if ( p.bits()) { // p is marked as deleted. Spin waiting for physical removal bkoff(); continue; } - else if ( pp && pp->next( pp->height() - 1 ).load( atomics::memory_order_relaxed ).bits() ) { + else if ( pp && pp->next( pp->height() - 1 ).load( atomics::memory_order_relaxed ).bits()) { // p is marked as deleted. Spin waiting for physical removal bkoff(); continue; @@ -254,14 +254,14 @@ namespace cds { namespace intrusive { for (;;) { marked_ptr p = refHead.next(0).load( atomics::memory_order_relaxed ); - if ( !p.ptr() ) { + if ( !p.ptr()) { // empty skip-list break; } node_type * pp = p.ptr(); // Logically deleted node is marked from highest level - if ( !pp->next( pp->height() - 1 ).load( atomics::memory_order_acquire ).bits() ) { + if ( !pp->next( pp->height() - 1 ).load( atomics::memory_order_acquire ).bits()) { m_pNode = pp; break; } @@ -587,7 +587,7 @@ namespace cds { namespace intrusive { { assert( pVal ); - typename node_builder::node_disposer()( node_traits::to_node_ptr(pVal) ); + typename node_builder::node_disposer()( node_traits::to_node_ptr(pVal)); disposer()( pVal ); } @@ -602,7 +602,7 @@ namespace cds { namespace intrusive { static void dispose_chain( node_type * pChain ) { if ( pChain ) { - assert( !gc::is_locked() ); + assert( !gc::is_locked()); auto f = [&pChain]() -> cds::urcu::retired_ptr { node_type * p = pChain; @@ -700,7 +700,7 @@ namespace cds { namespace intrusive { template bool find_position( Q const& val, position& pos, Compare cmp, bool bStopIfFound ) { - assert( gc::is_locked() ); + assert( gc::is_locked()); node_type * pPred; marked_node_ptr pSucc; @@ -714,7 +714,7 @@ namespace cds { namespace intrusive { while ( true ) { pCur = pPred->next( nLevel ).load( memory_model::memory_order_acquire ); - if ( pCur.bits() ) { + if ( pCur.bits()) { // pCur.bits() means that pPred is logically deleted goto retry; } @@ -727,24 +727,24 @@ namespace cds { namespace intrusive { // pSucc contains deletion mark for pCur pSucc = pCur->next( nLevel ).load( memory_model::memory_order_acquire ); - if ( pPred->next( nLevel ).load( memory_model::memory_order_acquire ).all() != pCur.ptr() ) + if ( pPred->next( nLevel ).load( memory_model::memory_order_acquire ).all() != pCur.ptr()) goto retry; - if ( pSucc.bits() ) { + if ( pSucc.bits()) { // pCur is marked, i.e. logically deleted. - marked_node_ptr p( pCur.ptr() ); + marked_node_ptr p( pCur.ptr()); # ifdef _DEBUG if ( nLevel == 0 ) pCur->m_bUnlinked = true; # endif - if ( pPred->next( nLevel ).compare_exchange_strong( p, marked_node_ptr( pSucc.ptr() ), + if ( pPred->next( nLevel ).compare_exchange_strong( p, marked_node_ptr( pSucc.ptr()), memory_model::memory_order_release, atomics::memory_order_relaxed )) { if ( nLevel == 0 ) { if ( !is_extracted( pSucc )) { // We cannot free the node at this moment since RCU is locked // Link deleted nodes to a chain to free later - pos.dispose( pCur.ptr() ); + pos.dispose( pCur.ptr()); m_Stat.onEraseWhileFind(); } else { @@ -780,7 +780,7 @@ namespace cds { namespace intrusive { bool find_min_position( position& pos ) { - assert( gc::is_locked() ); + assert( gc::is_locked()); node_type * pPred; marked_node_ptr pSucc; @@ -796,29 +796,29 @@ namespace cds { namespace intrusive { // head cannot be deleted assert( pCur.bits() == 0 ); - if ( pCur.ptr() ) { + if ( pCur.ptr()) { // pSucc contains deletion mark for pCur pSucc = pCur->next( nLevel ).load( memory_model::memory_order_acquire ); - if ( pPred->next( nLevel ).load( memory_model::memory_order_acquire ).all() != pCur.ptr() ) + if ( pPred->next( nLevel ).load( memory_model::memory_order_acquire ).all() != pCur.ptr()) goto retry; - if ( pSucc.bits() ) { + if ( pSucc.bits()) { // pCur is marked, i.e. logically deleted. # ifdef _DEBUG if ( nLevel == 0 ) pCur->m_bUnlinked = true; # endif - marked_node_ptr p( pCur.ptr() ); - if ( pPred->next( nLevel ).compare_exchange_strong( p, marked_node_ptr( pSucc.ptr() ), + marked_node_ptr p( pCur.ptr()); + if ( pPred->next( nLevel ).compare_exchange_strong( p, marked_node_ptr( pSucc.ptr()), memory_model::memory_order_release, atomics::memory_order_relaxed )) { if ( nLevel == 0 ) { if ( !is_extracted( pSucc )) { // We cannot free the node at this moment since RCU is locked // Link deleted nodes to a chain to free later - pos.dispose( pCur.ptr() ); + pos.dispose( pCur.ptr()); m_Stat.onEraseWhileFind(); } else { @@ -839,7 +839,7 @@ namespace cds { namespace intrusive { bool find_max_position( position& pos ) { - assert( gc::is_locked() ); + assert( gc::is_locked()); node_type * pPred; marked_node_ptr pSucc; @@ -852,7 +852,7 @@ namespace cds { namespace intrusive { while ( true ) { pCur = pPred->next( nLevel ).load( memory_model::memory_order_acquire ); - if ( pCur.bits() ) { + if ( pCur.bits()) { // pCur.bits() means that pPred is logically deleted goto retry; } @@ -865,24 +865,24 @@ namespace cds { namespace intrusive { // pSucc contains deletion mark for pCur pSucc = pCur->next( nLevel ).load( memory_model::memory_order_acquire ); - if ( pPred->next( nLevel ).load( memory_model::memory_order_acquire ).all() != pCur.ptr() ) + if ( pPred->next( nLevel ).load( memory_model::memory_order_acquire ).all() != pCur.ptr()) goto retry; - if ( pSucc.bits() ) { + if ( pSucc.bits()) { // pCur is marked, i.e. logically deleted. # ifdef _DEBUG if ( nLevel == 0 ) pCur->m_bUnlinked = true; # endif - marked_node_ptr p( pCur.ptr() ); - if ( pPred->next( nLevel ).compare_exchange_strong( p, marked_node_ptr( pSucc.ptr() ), + marked_node_ptr p( pCur.ptr()); + if ( pPred->next( nLevel ).compare_exchange_strong( p, marked_node_ptr( pSucc.ptr()), memory_model::memory_order_release, atomics::memory_order_relaxed )) { if ( nLevel == 0 ) { if ( !is_extracted( pSucc )) { // We cannot free the node at this moment since RCU is locked // Link deleted nodes to a chain to free later - pos.dispose( pCur.ptr() ); + pos.dispose( pCur.ptr()); m_Stat.onEraseWhileFind(); } else { @@ -893,7 +893,7 @@ namespace cds { namespace intrusive { goto retry; } else { - if ( !pSucc.ptr() ) + if ( !pSucc.ptr()) break; pPred = pCur.ptr(); @@ -911,7 +911,7 @@ namespace cds { namespace intrusive { template bool insert_at_position( value_type& val, node_type * pNode, position& pos, Func f ) { - assert( gc::is_locked() ); + assert( gc::is_locked()); unsigned int nHeight = pNode->height(); pNode->clear_tower(); @@ -935,12 +935,12 @@ namespace cds { namespace intrusive { if ( !pNode->next( nLevel ).compare_exchange_strong( p, q, memory_model::memory_order_acquire, atomics::memory_order_relaxed )) { // pNode has been marked as removed while we are inserting it // Stop inserting - assert( p.bits() ); + assert( p.bits()); m_Stat.onLogicDeleteWhileInsert(); return true; } p = q; - if ( pos.pPrev[nLevel]->next(nLevel).compare_exchange_strong( q, marked_node_ptr( pNode ), memory_model::memory_order_release, atomics::memory_order_relaxed ) ) + if ( pos.pPrev[nLevel]->next(nLevel).compare_exchange_strong( q, marked_node_ptr( pNode ), memory_model::memory_order_release, atomics::memory_order_relaxed )) break; // Renew insert position @@ -959,7 +959,7 @@ namespace cds { namespace intrusive { bool try_remove_at( node_type * pDel, position& pos, Func f, bool bExtract ) { assert( pDel != nullptr ); - assert( gc::is_locked() ); + assert( gc::is_locked()); marked_node_ptr pSucc; @@ -977,7 +977,7 @@ namespace cds { namespace intrusive { pSucc = pDel->next(0).load( memory_model::memory_order_relaxed ); while ( true ) { - if ( pSucc.bits() ) + if ( pSucc.bits()) return false; int const nMask = bExtract ? 3 : 1; @@ -990,8 +990,8 @@ namespace cds { namespace intrusive { pSucc = pDel; for ( int nLevel = static_cast( pDel->height() - 1 ); nLevel >= 0; --nLevel ) { if ( !pos.pPrev[nLevel]->next(nLevel).compare_exchange_strong( pSucc, - marked_node_ptr( pDel->next(nLevel).load(memory_model::memory_order_relaxed).ptr() ), - memory_model::memory_order_release, atomics::memory_order_relaxed) ) + marked_node_ptr( pDel->next(nLevel).load(memory_model::memory_order_relaxed).ptr()), + memory_model::memory_order_release, atomics::memory_order_relaxed)) { // Do slow erase find_position( *node_traits::to_value_ptr(pDel), pos, key_comparator(), false ); @@ -1045,7 +1045,7 @@ namespace cds { namespace intrusive { continue; while ( pCur != pNull ) { - if ( pCur.bits() ) { + if ( pCur.bits()) { // Wait until pCur is removed unsigned int nAttempt = 0; while ( pCur.bits() && nAttempt++ < 16 ) { @@ -1054,22 +1054,22 @@ namespace cds { namespace intrusive { } bkoff.reset(); - if ( pCur.bits() ) { + if ( pCur.bits()) { // Maybe, we are on deleted node sequence // Abort searching, try slow-path return find_fastpath_abort; } } - if ( pCur.ptr() ) { - int nCmp = cmp( *node_traits::to_value_ptr( pCur.ptr() ), val ); + if ( pCur.ptr()) { + int nCmp = cmp( *node_traits::to_value_ptr( pCur.ptr()), val ); if ( nCmp < 0 ) { pPred = pCur.ptr(); pCur = pCur->next(nLevel).load( memory_model::memory_order_acquire ); } else if ( nCmp == 0 ) { // found - f( *node_traits::to_value_ptr( pCur.ptr() ), val ); + f( *node_traits::to_value_ptr( pCur.ptr()), val ); return find_fastpath_found; } else // pCur > val - go down @@ -1143,7 +1143,7 @@ namespace cds { namespace intrusive { { rcu_lock rcuLock; - if ( !find_position( val, pos, cmp, false ) ) { + if ( !find_position( val, pos, cmp, false )) { m_Stat.onEraseFailed(); bRet = false; } @@ -1172,11 +1172,11 @@ namespace cds { namespace intrusive { value_type * do_extract_key( Q const& key, Compare cmp, position& pos ) { // RCU should be locked!!! - assert( gc::is_locked() ); + assert( gc::is_locked()); node_type * pDel; - if ( !find_position( key, pos, cmp, false ) ) { + if ( !find_position( key, pos, cmp, false )) { m_Stat.onExtractFailed(); pDel = nullptr; } @@ -1231,7 +1231,7 @@ namespace cds { namespace intrusive { value_type * do_extract_min() { - assert( !gc::is_locked() ); + assert( !gc::is_locked()); position pos; node_type * pDel; @@ -1239,7 +1239,7 @@ namespace cds { namespace intrusive { { rcu_lock l; - if ( !find_min_position( pos ) ) { + if ( !find_min_position( pos )) { m_Stat.onExtractMinFailed(); pDel = nullptr; } @@ -1247,7 +1247,7 @@ namespace cds { namespace intrusive { pDel = pos.pCur; unsigned int const nHeight = pDel->height(); - if ( try_remove_at( pDel, pos, []( value_type const& ) {}, true ) ) { + if ( try_remove_at( pDel, pos, []( value_type const& ) {}, true )) { --m_ItemCounter; m_Stat.onRemoveNode( nHeight ); m_Stat.onExtractMinSuccess(); @@ -1264,7 +1264,7 @@ namespace cds { namespace intrusive { value_type * do_extract_max() { - assert( !gc::is_locked() ); + assert( !gc::is_locked()); position pos; node_type * pDel; @@ -1272,7 +1272,7 @@ namespace cds { namespace intrusive { { rcu_lock l; - if ( !find_max_position( pos ) ) { + if ( !find_max_position( pos )) { m_Stat.onExtractMaxFailed(); pDel = nullptr; } @@ -1280,7 +1280,7 @@ namespace cds { namespace intrusive { pDel = pos.pCur; unsigned int const nHeight = pDel->height(); - if ( try_remove_at( pDel, pos, []( value_type const& ) {}, true ) ) { + if ( try_remove_at( pDel, pos, []( value_type const& ) {}, true )) { --m_ItemCounter; m_Stat.onRemoveNode( nHeight ); m_Stat.onExtractMaxSuccess(); @@ -1342,19 +1342,19 @@ namespace cds { namespace intrusive { /// Returns a forward iterator addressing the first element in a set iterator begin() { - return iterator( *m_Head.head() ); + return iterator( *m_Head.head()); } /// Returns a forward const iterator addressing the first element in a set const_iterator begin() const { - return const_iterator( *m_Head.head() ); + return const_iterator( *m_Head.head()); } /// Returns a forward const iterator addressing the first element in a set const_iterator cbegin() const { - return const_iterator( *m_Head.head() ); + return const_iterator( *m_Head.head()); } /// Returns a forward iterator that addresses the location succeeding the last element in a set. @@ -1590,7 +1590,7 @@ namespace cds { namespace intrusive { { rcu_lock l; - if ( !find_position( val, pos, key_comparator(), false ) ) { + if ( !find_position( val, pos, key_comparator(), false )) { m_Stat.onUnlinkFailed(); bRet = false; } @@ -1712,7 +1712,7 @@ namespace cds { namespace intrusive { skip_list theList; // ... - typename skip_list::exempt_ptr ep( theList.extract_max() ); + typename skip_list::exempt_ptr ep( theList.extract_max()); if ( ep ) { // Deal with ep //... @@ -1990,7 +1990,7 @@ namespace cds { namespace intrusive { this sequence \code set.clear(); - assert( set.empty() ); + assert( set.empty()); \endcode the assertion could be raised. @@ -1999,7 +1999,7 @@ namespace cds { namespace intrusive { void clear() { exempt_ptr ep; - while ( (ep = extract_min()) ); + while ( (ep = extract_min())); } /// Returns maximum height of skip-list. The max height is a constant for each object and does not exceed 32. diff --git a/cds/intrusive/split_list.h b/cds/intrusive/split_list.h index 017a39ad..f8183cad 100644 --- a/cds/intrusive/split_list.h +++ b/cds/intrusive/split_list.h @@ -926,14 +926,14 @@ namespace cds { namespace intrusive { #endif find( Q& key ) { - return find_iterator_( key, key_comparator() ); + return find_iterator_( key, key_comparator()); } //@cond template typename std::enable_if< std::is_same::value && is_iterable_list< ordered_list >::value, iterator >::type find( Q const& key ) { - return find_iterator_( key, key_comparator() ); + return find_iterator_( key, key_comparator()); } //@endcond @@ -979,7 +979,7 @@ namespace cds { namespace intrusive { find_with( Q& key, Less pred ) { CDS_UNUSED( pred ); - return find_iterator_( key, typename ordered_list_adapter::template make_compare_from_less() ); + return find_iterator_( key, typename ordered_list_adapter::template make_compare_from_less()); } //@cond template @@ -987,7 +987,7 @@ namespace cds { namespace intrusive { find_with( Q const& key, Less pred ) { CDS_UNUSED( pred ); - return find_iterator_( key, typename ordered_list_adapter::template make_compare_from_less() ); + return find_iterator_( key, typename ordered_list_adapter::template make_compare_from_less()); } //@endcond @@ -1172,9 +1172,9 @@ namespace cds { namespace intrusive { if ( pBucket ) return pBucket; - pBucket = alloc_aux_node( split_list::dummy_hash( nBucket ) ); + pBucket = alloc_aux_node( split_list::dummy_hash( nBucket )); if ( pBucket ) { - if ( m_List.insert_aux_node( pParentBucket, pBucket ) ) { + if ( m_List.insert_aux_node( pParentBucket, pBucket )) { m_Buckets.bucket( nBucket, pBucket ); m_Stat.onNewBucket(); return pBucket; @@ -1209,7 +1209,7 @@ namespace cds { namespace intrusive { if ( pHead == nullptr ) pHead = init_bucket( nBucket ); - assert( pHead->is_dummy() ); + assert( pHead->is_dummy()); return pHead; } @@ -1228,7 +1228,7 @@ namespace cds { namespace intrusive { assert( pNode != nullptr ); // insert_aux_node cannot return false for empty list - CDS_VERIFY( m_List.insert_aux_node( pNode ) ); + CDS_VERIFY( m_List.insert_aux_node( pNode )); m_Buckets.bucket( 0, pNode ); } @@ -1246,10 +1246,10 @@ namespace cds { namespace intrusive { size_t sz = m_nBucketCountLog2.load( memory_model::memory_order_relaxed ); const size_t nBucketCount = static_cast(1) << sz; - if ( nBucketCount < m_Buckets.capacity() ) { + if ( nBucketCount < m_Buckets.capacity()) { // we may grow the bucket table const size_t nLoadFactor = m_Buckets.load_factor(); - if ( nMaxCount < max_item_count( nBucketCount, nLoadFactor ) ) + if ( nMaxCount < max_item_count( nBucketCount, nLoadFactor )) return; // someone already have updated m_nBucketCountLog2, so stop here m_nMaxItemCount.compare_exchange_strong( nMaxCount, max_item_count( nBucketCount << 1, nLoadFactor ), @@ -1264,7 +1264,7 @@ namespace cds { namespace intrusive { bool find_( Q& val, Compare cmp, Func f ) { size_t nHash = hash_value( val ); - split_list::details::search_value_type sv( val, split_list::regular_hash( nHash ) ); + split_list::details::search_value_type sv( val, split_list::regular_hash( nHash )); aux_node_type * pHead = get_bucket( nHash ); assert( pHead != nullptr ); @@ -1278,18 +1278,18 @@ namespace cds { namespace intrusive { bool find_( Q const& val, Compare cmp ) { size_t nHash = hash_value( val ); - split_list::details::search_value_type sv( val, split_list::regular_hash( nHash ) ); + split_list::details::search_value_type sv( val, split_list::regular_hash( nHash )); aux_node_type * pHead = get_bucket( nHash ); assert( pHead != nullptr ); - return m_Stat.onFind( m_List.find_at( pHead, sv, cmp ) ); + return m_Stat.onFind( m_List.find_at( pHead, sv, cmp )); } template iterator find_iterator_( Q const& val, Compare cmp ) { size_t nHash = hash_value( val ); - split_list::details::search_value_type sv( val, split_list::regular_hash( nHash ) ); + split_list::details::search_value_type sv( val, split_list::regular_hash( nHash )); aux_node_type * pHead = get_bucket( nHash ); assert( pHead != nullptr ); @@ -1300,36 +1300,36 @@ namespace cds { namespace intrusive { guarded_ptr get_( Q const& val, Compare cmp ) { size_t nHash = hash_value( val ); - split_list::details::search_value_type sv( val, split_list::regular_hash( nHash ) ); + split_list::details::search_value_type sv( val, split_list::regular_hash( nHash )); aux_node_type * pHead = get_bucket( nHash ); assert( pHead != nullptr ); guarded_ptr gp = m_List.get_at( pHead, sv, cmp ); - m_Stat.onFind( !gp.empty() ); + m_Stat.onFind( !gp.empty()); return gp; } template guarded_ptr get_( Q const& key ) { - return get_( key, key_comparator() ); + return get_( key, key_comparator()); } template guarded_ptr get_with_( Q const& key, Less ) { - return get_( key, typename ordered_list_adapter::template make_compare_from_less() ); + return get_( key, typename ordered_list_adapter::template make_compare_from_less()); } template bool erase_( Q const& val, Compare cmp, Func f ) { size_t nHash = hash_value( val ); - split_list::details::search_value_type sv( val, split_list::regular_hash( nHash ) ); + split_list::details::search_value_type sv( val, split_list::regular_hash( nHash )); aux_node_type * pHead = get_bucket( nHash ); assert( pHead != nullptr ); - if ( m_List.erase_at( pHead, sv, cmp, f ) ) { + if ( m_List.erase_at( pHead, sv, cmp, f )) { --m_ItemCounter; m_Stat.onEraseSuccess(); return true; @@ -1342,11 +1342,11 @@ namespace cds { namespace intrusive { bool erase_( Q const& val, Compare cmp ) { size_t nHash = hash_value( val ); - split_list::details::search_value_type sv( val, split_list::regular_hash( nHash ) ); + split_list::details::search_value_type sv( val, split_list::regular_hash( nHash )); aux_node_type * pHead = get_bucket( nHash ); assert( pHead != nullptr ); - if ( m_List.erase_at( pHead, sv, cmp ) ) { + if ( m_List.erase_at( pHead, sv, cmp )) { --m_ItemCounter; m_Stat.onEraseSuccess(); return true; @@ -1359,7 +1359,7 @@ namespace cds { namespace intrusive { guarded_ptr extract_( Q const& val, Compare cmp ) { size_t nHash = hash_value( val ); - split_list::details::search_value_type sv( val, split_list::regular_hash( nHash ) ); + split_list::details::search_value_type sv( val, split_list::regular_hash( nHash )); aux_node_type * pHead = get_bucket( nHash ); assert( pHead != nullptr ); @@ -1376,13 +1376,13 @@ namespace cds { namespace intrusive { template guarded_ptr extract_( Q const& key ) { - return extract_( key, key_comparator() ); + return extract_( key, key_comparator()); } template guarded_ptr extract_with_( Q const& key, Less ) { - return extract_( key, typename ordered_list_adapter::template make_compare_from_less() ); + return extract_( key, typename ordered_list_adapter::template make_compare_from_less()); } //@endcond diff --git a/cds/intrusive/split_list_nogc.h b/cds/intrusive/split_list_nogc.h index 8e2c44d7..7e96194b 100644 --- a/cds/intrusive/split_list_nogc.h +++ b/cds/intrusive/split_list_nogc.h @@ -190,7 +190,7 @@ namespace cds { namespace intrusive { */ SplitListSet() : m_nBucketCountLog2(1) - , m_nMaxItemCount( max_item_count(2, m_Buckets.load_factor()) ) + , m_nMaxItemCount( max_item_count(2, m_Buckets.load_factor())) { init(); } @@ -202,7 +202,7 @@ namespace cds { namespace intrusive { ) : m_Buckets( nItemCount, nLoadFactor ) , m_nBucketCountLog2(1) - , m_nMaxItemCount( max_item_count(2, m_Buckets.load_factor()) ) + , m_nMaxItemCount( max_item_count(2, m_Buckets.load_factor())) { init(); } @@ -281,7 +281,7 @@ namespace cds { namespace intrusive { value_type * contains( Q const& key ) { iterator it = find_( key ); - if ( it == end() ) + if ( it == end()) return nullptr; return &*it; } @@ -304,7 +304,7 @@ namespace cds { namespace intrusive { value_type * contains( Q const& key, Less pred ) { iterator it = find_with_( key, pred ); - if ( it == end() ) + if ( it == end()) return nullptr; return &*it; } @@ -458,7 +458,7 @@ namespace cds { namespace intrusive { */ iterator begin() { - return iterator( m_List.begin(), m_List.end() ); + return iterator( m_List.begin(), m_List.end()); } /// Returns an iterator that addresses the location succeeding the last element in a split-list @@ -470,31 +470,31 @@ namespace cds { namespace intrusive { */ iterator end() { - return iterator( m_List.end(), m_List.end() ); + return iterator( m_List.end(), m_List.end()); } /// Returns a forward const iterator addressing the first element in a split-list const_iterator begin() const { - return const_iterator( m_List.begin(), m_List.end() ); + return const_iterator( m_List.begin(), m_List.end()); } /// Returns a forward const iterator addressing the first element in a split-list const_iterator cbegin() const { - return const_iterator( m_List.cbegin(), m_List.cend() ); + return const_iterator( m_List.cbegin(), m_List.cend()); } /// Returns an const iterator that addresses the location succeeding the last element in a split-list const_iterator end() const { - return const_iterator( m_List.end(), m_List.end() ); + return const_iterator( m_List.end(), m_List.end()); } /// Returns an const iterator that addresses the location succeeding the last element in a split-list const_iterator cend() const { - return const_iterator( m_List.cend(), m_List.cend() ); + return const_iterator( m_List.cend(), m_List.cend()); } //@} @@ -509,10 +509,10 @@ namespace cds { namespace intrusive { node_traits::to_node_ptr( val )->m_nHash = split_list::regular_hash( nHash ); list_iterator it = m_List.insert_at_( pHead, val ); - if ( it != m_List.end() ) { + if ( it != m_List.end()) { inc_item_count(); m_Stat.onInsertSuccess(); - return iterator( it, m_List.end() ); + return iterator( it, m_List.end()); } m_Stat.onInsertFailed(); return end(); @@ -528,7 +528,7 @@ namespace cds { namespace intrusive { node_traits::to_node_ptr( val )->m_nHash = split_list::regular_hash( nHash ); std::pair ret = m_List.update_at_( pHead, val, func, bAllowInsert ); - if ( ret.first != m_List.end() ) { + if ( ret.first != m_List.end()) { if ( ret.second ) { inc_item_count(); m_Stat.onUpdateNew(); @@ -549,9 +549,9 @@ namespace cds { namespace intrusive { aux_node_type * pHead = get_bucket( nHash ); assert( pHead != nullptr ); - auto it = m_List.find_at_( pHead, sv, typename ordered_list_adapter::template make_compare_from_less() ); - m_Stat.onFind( it != m_List.end() ); - return iterator( it, m_List.end() ); + auto it = m_List.find_at_( pHead, sv, typename ordered_list_adapter::template make_compare_from_less()); + m_Stat.onFind( it != m_List.end()); + return iterator( it, m_List.end()); } template @@ -562,9 +562,9 @@ namespace cds { namespace intrusive { aux_node_type * pHead = get_bucket( nHash ); assert( pHead != nullptr ); - auto it = m_List.find_at_( pHead, sv, key_comparator() ); - m_Stat.onFind( it != m_List.end() ); - return iterator( it, m_List.end() ); + auto it = m_List.find_at_( pHead, sv, key_comparator()); + m_Stat.onFind( it != m_List.end()); + return iterator( it, m_List.end()); } template @@ -628,13 +628,13 @@ namespace cds { namespace intrusive { aux_node_type * pBucket = m_Buckets.bucket( nBucket ); back_off bkoff; - for ( ;; pBucket = m_Buckets.bucket( nBucket ) ) { + for ( ;; pBucket = m_Buckets.bucket( nBucket )) { if ( pBucket ) return pBucket; - pBucket = alloc_aux_node( split_list::dummy_hash( nBucket ) ); + pBucket = alloc_aux_node( split_list::dummy_hash( nBucket )); if ( pBucket ) { - if ( m_List.insert_aux_node( pParentBucket, pBucket ) ) { + if ( m_List.insert_aux_node( pParentBucket, pBucket )) { m_Buckets.bucket( nBucket, pBucket ); m_Stat.onNewBucket(); return pBucket; @@ -653,7 +653,7 @@ namespace cds { namespace intrusive { } // Another thread set the bucket. Wait while it done - for ( pBucket = m_Buckets.bucket( nBucket ); pBucket == nullptr; pBucket = m_Buckets.bucket( nBucket ) ) { + for ( pBucket = m_Buckets.bucket( nBucket ); pBucket == nullptr; pBucket = m_Buckets.bucket( nBucket )) { bkoff(); m_Stat.onBusyWaitBucketInit(); } @@ -669,7 +669,7 @@ namespace cds { namespace intrusive { if ( pHead == nullptr ) pHead = init_bucket( nBucket ); - assert( pHead->is_dummy() ); + assert( pHead->is_dummy()); return pHead; } @@ -680,7 +680,7 @@ namespace cds { namespace intrusive { aux_node_type * pNode = alloc_aux_node( 0 /*split_list::dummy_hash(0)*/ ); // insert_aux_node cannot return false for empty list - CDS_VERIFY( m_List.insert_aux_node( pNode ) ); + CDS_VERIFY( m_List.insert_aux_node( pNode )); m_Buckets.bucket( 0, pNode ); } @@ -698,10 +698,10 @@ namespace cds { namespace intrusive { size_t sz = m_nBucketCountLog2.load( memory_model::memory_order_relaxed ); const size_t nBucketCount = static_cast(1) << sz; - if ( nBucketCount < m_Buckets.capacity() ) { + if ( nBucketCount < m_Buckets.capacity()) { // we may grow the bucket table const size_t nLoadFactor = m_Buckets.load_factor(); - if ( nMaxCount < max_item_count( nBucketCount, nLoadFactor ) ) + if ( nMaxCount < max_item_count( nBucketCount, nLoadFactor )) return; // someone already have updated m_nBucketCountLog2, so stop here m_nMaxItemCount.compare_exchange_strong( nMaxCount, max_item_count( nBucketCount << 1, nLoadFactor ), diff --git a/cds/intrusive/split_list_rcu.h b/cds/intrusive/split_list_rcu.h index f91ffa04..e3d459ce 100644 --- a/cds/intrusive/split_list_rcu.h +++ b/cds/intrusive/split_list_rcu.h @@ -283,7 +283,7 @@ namespace cds { namespace intrusive { */ SplitListSet() : m_nBucketCountLog2(1) - , m_nMaxItemCount( max_item_count(2, m_Buckets.load_factor()) ) + , m_nMaxItemCount( max_item_count(2, m_Buckets.load_factor())) { init(); } @@ -295,7 +295,7 @@ namespace cds { namespace intrusive { ) : m_Buckets( nItemCount, nLoadFactor ) , m_nBucketCountLog2(1) - , m_nMaxItemCount( max_item_count(2, m_Buckets.load_factor()) ) + , m_nMaxItemCount( max_item_count(2, m_Buckets.load_factor())) { init(); } @@ -450,7 +450,7 @@ namespace cds { namespace intrusive { aux_node_type * pHead = get_bucket( nHash ); assert( pHead != nullptr ); - if ( m_List.unlink_at( pHead, val ) ) { + if ( m_List.unlink_at( pHead, val )) { --m_ItemCounter; m_Stat.onEraseSuccess(); return true; @@ -477,7 +477,7 @@ namespace cds { namespace intrusive { template bool erase( Q const& key ) { - return erase_( key, key_comparator() ); + return erase_( key, key_comparator()); } /// Deletes the item from the set using \p pred for searching @@ -491,7 +491,7 @@ namespace cds { namespace intrusive { bool erase_with( Q const& key, Less pred ) { CDS_UNUSED( pred ); - return erase_( key, typename ordered_list_adapter::template make_compare_from_less() ); + return erase_( key, typename ordered_list_adapter::template make_compare_from_less()); } /// Deletes the item from the set @@ -574,7 +574,7 @@ namespace cds { namespace intrusive { template exempt_ptr extract( Q const& key ) { - return exempt_ptr(extract_( key, key_comparator() )); + return exempt_ptr(extract_( key, key_comparator())); } /// Extracts an item from the set using \p pred for searching @@ -662,7 +662,7 @@ namespace cds { namespace intrusive { template bool contains( Q const& key ) { - return find_value( key, key_comparator() ); + return find_value( key, key_comparator()); } //@cond template @@ -683,7 +683,7 @@ namespace cds { namespace intrusive { bool contains( Q const& key, Less pred ) { CDS_UNUSED( pred ); - return find_value( key, typename ordered_list_adapter::template make_compare_from_less() ); + return find_value( key, typename ordered_list_adapter::template make_compare_from_less()); } //@cond template @@ -725,7 +725,7 @@ namespace cds { namespace intrusive { template raw_ptr get( Q const& key ) { - return get_( key, key_comparator() ); + return get_( key, key_comparator()); } /// Finds the key \p key and return the item found @@ -765,7 +765,7 @@ namespace cds { namespace intrusive { void clear() { iterator it = begin(); - while ( it != end() ) { + while ( it != end()) { iterator i(it); ++i; unlink( *it ); @@ -829,7 +829,7 @@ namespace cds { namespace intrusive { */ iterator begin() { - return iterator( m_List.begin(), m_List.end() ); + return iterator( m_List.begin(), m_List.end()); } /// Returns an iterator that addresses the location succeeding the last element in a split-list @@ -841,7 +841,7 @@ namespace cds { namespace intrusive { */ iterator end() { - return iterator( m_List.end(), m_List.end() ); + return iterator( m_List.end(), m_List.end()); } /// Returns a forward const iterator addressing the first element in a split-list @@ -852,7 +852,7 @@ namespace cds { namespace intrusive { /// Returns a forward const iterator addressing the first element in a split-list const_iterator cbegin() const { - return const_iterator( m_List.cbegin(), m_List.cend() ); + return const_iterator( m_List.cbegin(), m_List.cend()); } /// Returns an const iterator that addresses the location succeeding the last element in a split-list @@ -863,7 +863,7 @@ namespace cds { namespace intrusive { /// Returns an const iterator that addresses the location succeeding the last element in a split-list const_iterator cend() const { - return const_iterator( m_List.cend(), m_List.cend() ); + return const_iterator( m_List.cend(), m_List.cend()); } //@} @@ -899,7 +899,7 @@ namespace cds { namespace intrusive { static size_t parent_bucket( size_t nBucket ) { assert( nBucket > 0 ); - return nBucket & ~( 1 << bitop::MSBnz( nBucket ) ); + return nBucket & ~( 1 << bitop::MSBnz( nBucket )); } aux_node_type * init_bucket( size_t const nBucket ) @@ -919,13 +919,13 @@ namespace cds { namespace intrusive { aux_node_type * pBucket = m_Buckets.bucket( nBucket ); back_off bkoff; - for ( ;; pBucket = m_Buckets.bucket( nBucket ) ) { + for ( ;; pBucket = m_Buckets.bucket( nBucket )) { if ( pBucket ) return pBucket; - pBucket = alloc_aux_node( split_list::dummy_hash( nBucket ) ); + pBucket = alloc_aux_node( split_list::dummy_hash( nBucket )); if ( pBucket ) { - if ( m_List.insert_aux_node( pParentBucket, pBucket ) ) { + if ( m_List.insert_aux_node( pParentBucket, pBucket )) { m_Buckets.bucket( nBucket, pBucket ); m_Stat.onNewBucket(); return pBucket; @@ -944,7 +944,7 @@ namespace cds { namespace intrusive { } // Another thread set the bucket. Wait while it done - for ( pBucket = m_Buckets.bucket( nBucket ); pBucket == nullptr; pBucket = m_Buckets.bucket( nBucket ) ) { + for ( pBucket = m_Buckets.bucket( nBucket ); pBucket == nullptr; pBucket = m_Buckets.bucket( nBucket )) { bkoff(); m_Stat.onBusyWaitBucketInit(); } @@ -960,7 +960,7 @@ namespace cds { namespace intrusive { if ( pHead == nullptr ) pHead = init_bucket( nBucket ); - assert( pHead->is_dummy() ); + assert( pHead->is_dummy()); return pHead; } @@ -989,7 +989,7 @@ namespace cds { namespace intrusive { size_t sz = m_nBucketCountLog2.load(memory_model::memory_order_relaxed); const size_t nBucketCount = static_cast(1) << sz; - if ( nBucketCount < m_Buckets.capacity() ) { + if ( nBucketCount < m_Buckets.capacity()) { // we may grow the bucket table const size_t nLoadFactor = m_Buckets.load_factor(); if ( nMaxCount < max_item_count( nBucketCount, nLoadFactor )) @@ -1072,7 +1072,7 @@ namespace cds { namespace intrusive { aux_node_type * pHead = get_bucket( nHash ); assert( pHead != nullptr ); - if ( m_List.erase_at( pHead, sv, cmp ) ) { + if ( m_List.erase_at( pHead, sv, cmp )) { --m_ItemCounter; m_Stat.onEraseSuccess(); return true; diff --git a/cds/intrusive/striped_set.h b/cds/intrusive/striped_set.h index 269577df..50003437 100644 --- a/cds/intrusive/striped_set.h +++ b/cds/intrusive/striped_set.h @@ -409,7 +409,7 @@ namespace cds { namespace intrusive { for ( bucket_iterator it = pCur->begin(); it != itEnd; it = itNext ) { itNext = it; ++itNext; - bucket( m_Hash( *it ) )->move_item( *pCur, it ); + bucket( m_Hash( *it ))->move_item( *pCur, it ); } pCur->clear(); } @@ -425,7 +425,7 @@ namespace cds { namespace intrusive { size_t volatile& refBucketMask = m_nBucketMask; scoped_resize_lock al( m_MutexPolicy ); - if ( al.success() ) { + if ( al.success()) { if ( nOldCapacity != refBucketMask + 1 ) { // someone resized already return; @@ -486,7 +486,7 @@ namespace cds { namespace intrusive { : m_Buckets( nullptr ) , m_nBucketMask( ( nCapacity ? calc_init_capacity(nCapacity) : c_nMinimalCapacity ) - 1 ) , m_MutexPolicy( m_nBucketMask + 1 ) - , m_ResizingPolicy( std::forward( resizingPolicy ) ) + , m_ResizingPolicy( std::forward( resizingPolicy )) { alloc_bucket_table( m_nBucketMask + 1 ); } diff --git a/cds/intrusive/striped_set/adapter.h b/cds/intrusive/striped_set/adapter.h index f51ffeaf..cb1574aa 100644 --- a/cds/intrusive/striped_set/adapter.h +++ b/cds/intrusive/striped_set/adapter.h @@ -255,8 +255,8 @@ namespace cds { namespace intrusive { return std::make_pair( true, res.second ); } else { - auto it = m_Set.find( val, key_comparator() ); - if ( it == m_Set.end() ) + auto it = m_Set.find( val, key_comparator()); + if ( it == m_Set.end()) return std::make_pair( false, false ); f( false, *it, val ); return std::make_pair( true, false ); @@ -265,7 +265,7 @@ namespace cds { namespace intrusive { bool unlink( value_type& val ) { - iterator it = m_Set.find( val, key_comparator() ); + iterator it = m_Set.find( val, key_comparator()); if ( it == m_Set.end() || &(*it) != &val ) return false; m_Set.erase( it ); @@ -275,7 +275,7 @@ namespace cds { namespace intrusive { template value_type * erase( Q const& key, Func f ) { - iterator it = m_Set.find( key, key_comparator() ); + iterator it = m_Set.find( key, key_comparator()); if (it == m_Set.end()) return nullptr; value_type& val = *it; @@ -306,7 +306,7 @@ namespace cds { namespace intrusive { bool find( Q const& key, Compare cmp, Func f ) { iterator it = m_Set.find( key, cmp ); - if ( it == m_Set.end() ) + if ( it == m_Set.end()) return false; f( *it, key ); return true; diff --git a/cds/intrusive/striped_set/boost_list.h b/cds/intrusive/striped_set/boost_list.h index 4205b594..ac52bbb5 100644 --- a/cds/intrusive/striped_set/boost_list.h +++ b/cds/intrusive/striped_set/boost_list.h @@ -81,7 +81,7 @@ namespace cds { namespace intrusive { namespace striped_set { iterator itEnd = m_List.end(); iterator it; for ( it = m_List.begin(); it != itEnd; ++it ) { - if ( !pred( *it, key ) ) + if ( !pred( *it, key )) break; } return it; @@ -102,7 +102,7 @@ namespace cds { namespace intrusive { namespace striped_set { template bool insert( value_type& val, Func f ) { - iterator it = find_key( val, find_predicate() ); + iterator it = find_key( val, find_predicate()); if ( it == m_List.end() || key_comparator()(val, *it) != 0 ) { m_List.insert( it, val ); f( val ); @@ -117,7 +117,7 @@ namespace cds { namespace intrusive { namespace striped_set { template std::pair update( value_type& val, Func f, bool bAllowInsert ) { - iterator it = find_key( val, find_predicate() ); + iterator it = find_key( val, find_predicate()); if ( it == m_List.end() || key_comparator()(val, *it) != 0 ) { // insert new if ( !bAllowInsert ) @@ -136,7 +136,7 @@ namespace cds { namespace intrusive { namespace striped_set { bool unlink( value_type& val ) { - iterator it = find_key( val, find_predicate() ); + iterator it = find_key( val, find_predicate()); if ( it == m_List.end() || &(*it) != &val ) return false; @@ -147,7 +147,7 @@ namespace cds { namespace intrusive { namespace striped_set { template value_type * erase( Q const& key, Func f ) { - iterator it = find_key( key, find_predicate() ); + iterator it = find_key( key, find_predicate()); if ( it == m_List.end() || key_comparator()(key, *it) != 0 ) return nullptr; @@ -163,7 +163,7 @@ namespace cds { namespace intrusive { namespace striped_set { value_type * erase( Q const& key, Less pred, Func f ) { iterator it = find_key( key, pred ); - if ( it == m_List.end() || pred( key, *it ) || pred( *it, key ) ) + if ( it == m_List.end() || pred( key, *it ) || pred( *it, key )) return nullptr; // key exists @@ -184,7 +184,7 @@ namespace cds { namespace intrusive { namespace striped_set { bool find( Q& key, Less pred, Func f ) { iterator it = find_key( key, pred ); - if ( it == m_List.end() || pred( key, *it ) || pred( *it, key ) ) + if ( it == m_List.end() || pred( key, *it ) || pred( *it, key )) return false; // key exists diff --git a/cds/intrusive/striped_set/boost_slist.h b/cds/intrusive/striped_set/boost_slist.h index 9b9e3721..dc3787c9 100644 --- a/cds/intrusive/striped_set/boost_slist.h +++ b/cds/intrusive/striped_set/boost_slist.h @@ -63,9 +63,9 @@ namespace cds { namespace intrusive { namespace striped_set { iterator itPrev = m_List.before_begin(); iterator itEnd = m_List.end(); for ( iterator it = m_List.begin(); it != itEnd; ++it ) { - if ( pred( key, *it ) ) + if ( pred( key, *it )) itPrev = it; - else if ( pred( *it, key ) ) + else if ( pred( *it, key )) break; else return std::make_pair( itPrev, true ); @@ -76,7 +76,7 @@ namespace cds { namespace intrusive { namespace striped_set { template std::pair< iterator, bool > find_prev_item( Q const& key ) { - return find_prev_item_cmp( key, key_comparator() ); + return find_prev_item_cmp( key, key_comparator()); } template diff --git a/cds/intrusive/striped_set/boost_unordered_set.h b/cds/intrusive/striped_set/boost_unordered_set.h index e8eb8e51..f612b372 100644 --- a/cds/intrusive/striped_set/boost_unordered_set.h +++ b/cds/intrusive/striped_set/boost_unordered_set.h @@ -93,7 +93,7 @@ namespace cds { namespace intrusive { namespace striped_set { public: adapted_container() - : m_Set( typename container_type::bucket_traits( m_Buckets.buffer(), m_Buckets.capacity() ) ) + : m_Set( typename container_type::bucket_traits( m_Buckets.buffer(), m_Buckets.capacity()) ) {} container_type& base_container() @@ -120,7 +120,7 @@ namespace cds { namespace intrusive { namespace striped_set { } else { auto it = m_Set.find( val ); - if ( it == m_Set.end() ) + if ( it == m_Set.end()) return std::make_pair( false, false ); f( false, *it, val ); return std::make_pair( true, false ); @@ -129,7 +129,7 @@ namespace cds { namespace intrusive { namespace striped_set { bool unlink( value_type& val ) { - iterator it = m_Set.find( value_type( val ) ); + iterator it = m_Set.find( value_type( val )); if ( it == m_Set.end() || &(*it) != &val ) return false; m_Set.erase( it ); @@ -139,8 +139,8 @@ namespace cds { namespace intrusive { namespace striped_set { template value_type * erase( Q const& key, Func f ) { - iterator it = m_Set.find( key, typename container_type::hasher(), typename container_type::key_equal() ); - if ( it == m_Set.end() ) + iterator it = m_Set.find( key, typename container_type::hasher(), typename container_type::key_equal()); + if ( it == m_Set.end()) return nullptr; value_type& val = *it; f( val ); @@ -151,8 +151,8 @@ namespace cds { namespace intrusive { namespace striped_set { template value_type * erase( Q const& key, Less pred, Func f ) { - iterator it = m_Set.find( key, typename container_type::hasher(), equal_from_compare( pred ) ); - if ( it == m_Set.end() ) + iterator it = m_Set.find( key, typename container_type::hasher(), equal_from_compare( pred )); + if ( it == m_Set.end()) return nullptr; value_type& val = *it; f( val ); @@ -163,8 +163,8 @@ namespace cds { namespace intrusive { namespace striped_set { template bool find( Q& key, Func f ) { - iterator it = m_Set.find( key, typename container_type::hasher(), typename container_type::key_equal() ); - if ( it == m_Set.end() ) + iterator it = m_Set.find( key, typename container_type::hasher(), typename container_type::key_equal()); + if ( it == m_Set.end()) return false; f( *it, key ); return true; @@ -173,8 +173,8 @@ namespace cds { namespace intrusive { namespace striped_set { template bool find( Q& key, Less pred, Func f ) { - iterator it = m_Set.find( key, typename container_type::hasher(), equal_from_compare( pred ) ); - if ( it == m_Set.end() ) + iterator it = m_Set.find( key, typename container_type::hasher(), equal_from_compare( pred )); + if ( it == m_Set.end()) return false; f( *it, key ); return true; diff --git a/cds/intrusive/striped_set/striping_policy.h b/cds/intrusive/striped_set/striping_policy.h index 8c53aa53..4eebba12 100644 --- a/cds/intrusive/striped_set/striping_policy.h +++ b/cds/intrusive/striped_set/striping_policy.h @@ -198,7 +198,7 @@ namespace cds { namespace intrusive { namespace striped_set { lock_array_ptr create_lock_array( size_t nCapacity ) { m_nCapacity.store( nCapacity, atomics::memory_order_relaxed ); - return lock_array_ptr( lock_array_allocator().New( nCapacity ), lock_array_disposer() ); + return lock_array_ptr( lock_array_allocator().New( nCapacity ), lock_array_disposer()); } lock_type& acquire( size_t nHash ) @@ -211,7 +211,7 @@ namespace cds { namespace intrusive { namespace striped_set { // wait while resizing while ( true ) { who = m_Owner.load( atomics::memory_order_acquire ); - if ( !( who & 1 ) || (who >> 1) == (me & c_nOwnerMask) ) + if ( !( who & 1 ) || (who >> 1) == (me & c_nOwnerMask)) break; bkoff(); } @@ -226,7 +226,7 @@ namespace cds { namespace intrusive { namespace striped_set { lock.lock(); who = m_Owner.load( atomics::memory_order_acquire ); - if ( ( !(who & 1) || (who >> 1) == (me & c_nOwnerMask) ) && m_arrLocks == pLocks ) + if ( ( !(who & 1) || (who >> 1) == (me & c_nOwnerMask)) && m_arrLocks == pLocks ) return lock; lock.unlock(); } @@ -242,7 +242,7 @@ namespace cds { namespace intrusive { namespace striped_set { // wait while resizing while ( true ) { who = m_Owner.load( atomics::memory_order_acquire ); - if ( !( who & 1 ) || (who >> 1) == (me & c_nOwnerMask) ) + if ( !( who & 1 ) || (who >> 1) == (me & c_nOwnerMask)) break; bkoff(); } @@ -256,7 +256,7 @@ namespace cds { namespace intrusive { namespace striped_set { pLocks->lock_all(); who = m_Owner.load( atomics::memory_order_acquire ); - if ( ( !(who & 1) || (who >> 1) == (me & c_nOwnerMask) ) && m_arrLocks == pLocks ) + if ( ( !(who & 1) || (who >> 1) == (me & c_nOwnerMask)) && m_arrLocks == pLocks ) return pLocks; pLocks->unlock_all(); @@ -281,7 +281,7 @@ namespace cds { namespace intrusive { namespace striped_set { for ( size_t i = 0; i < nLockCount; ++i ) { typename lock_array_type::lock_type& lock = pOldLocks->at(i); bkoff.reset(); - while ( !lock.try_lock() ) + while ( !lock.try_lock()) bkoff(); lock.unlock(); } @@ -305,7 +305,7 @@ namespace cds { namespace intrusive { namespace striped_set { public: scoped_cell_lock( refinable& policy, size_t nHash ) - : m_guard( policy.acquire( nHash ), std::adopt_lock_t() ) + : m_guard( policy.acquire( nHash ), std::adopt_lock_t()) {} }; diff --git a/cds/intrusive/treiber_stack.h b/cds/intrusive/treiber_stack.h index 21984cb7..f0514ed1 100644 --- a/cds/intrusive/treiber_stack.h +++ b/cds/intrusive/treiber_stack.h @@ -820,7 +820,7 @@ namespace cds { namespace intrusive { pTop = m_Top.load( memory_model::memory_order_relaxed ); if ( pTop == nullptr ) return; - if ( m_Top.compare_exchange_weak( pTop, nullptr, memory_model::memory_order_acquire, atomics::memory_order_relaxed ) ) { + if ( m_Top.compare_exchange_weak( pTop, nullptr, memory_model::memory_order_acquire, atomics::memory_order_relaxed )) { m_ItemCounter.reset(); break; } @@ -831,7 +831,7 @@ namespace cds { namespace intrusive { node_type * p = pTop; pTop = p->m_pNext.load(memory_model::memory_order_relaxed); clear_links( p ); - gc::template retire( node_traits::to_value_ptr( *p ) ); + gc::template retire( node_traits::to_value_ptr( *p )); } } diff --git a/cds/intrusive/tsigas_cycle_queue.h b/cds/intrusive/tsigas_cycle_queue.h index a723fc7d..55076276 100644 --- a/cds/intrusive/tsigas_cycle_queue.h +++ b/cds/intrusive/tsigas_cycle_queue.h @@ -269,24 +269,24 @@ namespace cds { namespace intrusive { index_type temp = ( ate + 1 ) & nModulo ; // next item after tail // Looking for actual tail - while ( !is_free( tt ) ) { - if ( te != m_nTail.load(memory_model::memory_order_relaxed) ) // check the tail consistency + while ( !is_free( tt )) { + if ( te != m_nTail.load(memory_model::memory_order_relaxed)) // check the tail consistency goto TryAgain; - if ( temp == m_nHead.load(memory_model::memory_order_acquire) ) // queue full? + if ( temp == m_nHead.load(memory_model::memory_order_acquire)) // queue full? break; tt = m_buffer[ temp ].load(memory_model::memory_order_relaxed); ate = temp; temp = (temp + 1) & nModulo; } - if ( te != m_nTail.load(memory_model::memory_order_acquire) ) + if ( te != m_nTail.load(memory_model::memory_order_acquire)) continue; // Check whether queue is full - if ( temp == m_nHead.load(memory_model::memory_order_acquire) ) { + if ( temp == m_nHead.load(memory_model::memory_order_acquire)) { ate = ( temp + 1 ) & nModulo; tt = m_buffer[ ate ].load(memory_model::memory_order_relaxed); - if ( !is_free( tt ) ) { + if ( !is_free( tt )) { return false; // Queue is full } @@ -295,13 +295,13 @@ namespace cds { namespace intrusive { continue; } - if ( tt == reinterpret_cast(free1) ) + if ( tt == reinterpret_cast(free1)) pNewNode = reinterpret_cast(reinterpret_cast( pNewNode ) | 1); - if ( te != m_nTail.load(memory_model::memory_order_acquire) ) + if ( te != m_nTail.load(memory_model::memory_order_acquire)) continue; // get actual tail and try to enqueue new node - if ( m_buffer[ate].compare_exchange_strong( tt, pNewNode, memory_model::memory_order_release, atomics::memory_order_relaxed ) ) { + if ( m_buffer[ate].compare_exchange_strong( tt, pNewNode, memory_model::memory_order_release, atomics::memory_order_relaxed )) { if ( temp % 2 == 0 ) m_nTail.compare_exchange_strong( te, temp, memory_model::memory_order_release, atomics::memory_order_relaxed ); ++m_ItemCounter; @@ -332,23 +332,23 @@ namespace cds { namespace intrusive { value_type * pNull; // find the actual head after this loop - while ( is_free( tt ) ) { - if ( th != m_nHead.load(memory_model::memory_order_relaxed) ) + while ( is_free( tt )) { + if ( th != m_nHead.load(memory_model::memory_order_relaxed)) goto TryAgain; // two consecutive nullptr means the queue is empty - if ( temp == m_nTail.load(memory_model::memory_order_acquire) ) + if ( temp == m_nTail.load(memory_model::memory_order_acquire)) return nullptr; temp = ( temp + 1 ) & nModulo; tt = m_buffer[ temp ].load(memory_model::memory_order_relaxed); } - if ( th != m_nHead.load(memory_model::memory_order_relaxed) ) + if ( th != m_nHead.load(memory_model::memory_order_relaxed)) continue; // check whether the queue is empty - if ( temp == m_nTail.load(memory_model::memory_order_acquire) ) { + if ( temp == m_nTail.load(memory_model::memory_order_acquire)) { // help the enqueue to update end m_nTail.compare_exchange_weak( temp, (temp + 1) & nModulo, memory_model::memory_order_release, atomics::memory_order_relaxed ); continue; @@ -356,7 +356,7 @@ namespace cds { namespace intrusive { pNull = reinterpret_cast((reinterpret_cast(tt) & 1) ? free0 : free1); - if ( th != m_nHead.load(memory_model::memory_order_relaxed) ) + if ( th != m_nHead.load(memory_model::memory_order_relaxed)) continue; // Get the actual head, null means empty @@ -397,11 +397,11 @@ namespace cds { namespace intrusive { const value_type * tt = m_buffer[ temp ].load(memory_model::memory_order_relaxed); // find the actual head after this loop - while ( is_free( tt ) ) { - if ( th != m_nHead.load(memory_model::memory_order_relaxed) ) + while ( is_free( tt )) { + if ( th != m_nHead.load(memory_model::memory_order_relaxed)) goto TryAgain; // two consecutive nullptr means queue empty - if ( temp == m_nTail.load(memory_model::memory_order_relaxed) ) + if ( temp == m_nTail.load(memory_model::memory_order_relaxed)) return true; temp = ( temp + 1 ) & nModulo; tt = m_buffer[ temp ].load(memory_model::memory_order_relaxed); @@ -432,7 +432,7 @@ namespace cds { namespace intrusive { */ void clear() { - clear( disposer() ); + clear( disposer()); } /// Returns queue's item count diff --git a/cds/intrusive/vyukov_mpmc_cycle_queue.h b/cds/intrusive/vyukov_mpmc_cycle_queue.h index 9bc94f6c..3be7a7f7 100644 --- a/cds/intrusive/vyukov_mpmc_cycle_queue.h +++ b/cds/intrusive/vyukov_mpmc_cycle_queue.h @@ -228,7 +228,7 @@ namespace cds { namespace intrusive { */ void clear() { - clear( disposer() ); + clear( disposer()); } /// Checks if the queue is empty diff --git a/cds/memory/michael/allocator.h b/cds/memory/michael/allocator.h index 297957ab..b7cea674 100644 --- a/cds/memory/michael/allocator.h +++ b/cds/memory/michael/allocator.h @@ -199,7 +199,7 @@ namespace michael { ~page_cached_allocator() { void * pPage; - while ( m_FreeList.pop(pPage) ) + while ( m_FreeList.pop(pPage)) base_class::free( pPage ); } //@endcond @@ -208,7 +208,7 @@ namespace michael { void * alloc() { void * pPage; - if ( !m_FreeList.pop( pPage ) ) + if ( !m_FreeList.pop( pPage )) pPage = base_class::alloc(); return pPage; } @@ -305,7 +305,7 @@ namespace michael { /// Gets details::size_class struct for size-class index \p nIndex static const size_class * at( sizeclass_index nIndex ) { - assert( nIndex < size() ); + assert( nIndex < size()); return m_szClass + nIndex; } }; @@ -352,7 +352,7 @@ namespace michael { /// Push superblock descriptor to free-list void push( T * pDesc ) { - assert( base_class::node_algorithms::inited( static_cast(pDesc) ) ); + assert( base_class::node_algorithms::inited( static_cast(pDesc)) ); auto_lock al(m_access); base_class::push_back( *pDesc ); } @@ -361,11 +361,11 @@ namespace michael { T * pop() { auto_lock al(m_access); - if ( base_class::empty() ) + if ( base_class::empty()) return nullptr; T& rDesc = base_class::front(); base_class::pop_front(); - assert( base_class::node_algorithms::inited( static_cast(&rDesc) ) ); + assert( base_class::node_algorithms::inited( static_cast(&rDesc)) ); return &rDesc; } @@ -407,7 +407,7 @@ namespace michael { void push( T * pDesc ) { auto_lock al( m_access ); - assert( base_class::node_algorithms::inited( static_cast(pDesc) ) ); + assert( base_class::node_algorithms::inited( static_cast(pDesc)) ); base_class::push_back( *pDesc ); } @@ -415,11 +415,11 @@ namespace michael { T * pop() { auto_lock al( m_access ); - if ( base_class::empty() ) + if ( base_class::empty()) return nullptr; T& rDesc = base_class::front(); base_class::pop_front(); - assert( base_class::node_algorithms::inited( static_cast(&rDesc) ) ); + assert( base_class::node_algorithms::inited( static_cast(&rDesc)) ); return &rDesc; } @@ -429,8 +429,8 @@ namespace michael { assert(pDesc != nullptr); auto_lock al( m_access ); // !inited(pDesc) is equal to "pDesc is being linked to partial list" - if ( !base_class::node_algorithms::inited( static_cast(pDesc) ) ) { - base_class::erase( base_class::iterator_to( *pDesc ) ); + if ( !base_class::node_algorithms::inited( static_cast(pDesc)) ) { + base_class::erase( base_class::iterator_to( *pDesc )); return true; } return false; @@ -899,7 +899,7 @@ namespace michael { size_t getOSAllocSize() const { - assert( isOSAllocated() ); + assert( isOSAllocated()); return nSize; } @@ -925,13 +925,13 @@ namespace michael { superblock_desc * desc() { - assert( !isOSAllocated() ); - return (pDesc.bits() & bitAligned) ? reinterpret_cast( pDesc.ptr() )->desc() : pDesc.ptr(); + assert( !isOSAllocated()); + return (pDesc.bits() & bitAligned) ? reinterpret_cast( pDesc.ptr())->desc() : pDesc.ptr(); } block_header * begin() { - return (pDesc.bits() & bitAligned) ? reinterpret_cast( pDesc.ptr() ) : this; + return (pDesc.bits() & bitAligned) ? reinterpret_cast( pDesc.ptr()) : this; } bool isAligned() const @@ -952,8 +952,8 @@ namespace michael { size_t getOSAllocSize() const { - assert( isOSAllocated() ); - return reinterpret_cast( pDesc.ptr() ) >> 2; + assert( isOSAllocated()); + return reinterpret_cast( pDesc.ptr()) >> 2; } }; @@ -1143,10 +1143,10 @@ namespace michael { pDesc = partialList.pop(); break; } - } while ( !pPartial.compare_exchange_weak( pDesc, nullptr, atomics::memory_order_release, atomics::memory_order_relaxed ) ); + } while ( !pPartial.compare_exchange_weak( pDesc, nullptr, atomics::memory_order_release, atomics::memory_order_relaxed )); - //assert( pDesc == nullptr || free_desc_list::node_algorithms::inited( static_cast(pDesc) )); - //assert( pDesc == nullptr || partial_desc_list::node_algorithms::inited( static_cast(pDesc) ) ); + //assert( pDesc == nullptr || free_desc_list::node_algorithms::inited( static_cast(pDesc))); + //assert( pDesc == nullptr || partial_desc_list::node_algorithms::inited( static_cast(pDesc)) ); return pDesc; } @@ -1154,10 +1154,10 @@ namespace michael { void add_partial( superblock_desc * pDesc ) { assert( pPartial != pDesc ); - //assert( partial_desc_list::node_algorithms::inited( static_cast(pDesc) ) ); + //assert( partial_desc_list::node_algorithms::inited( static_cast(pDesc)) ); superblock_desc * pCur = nullptr; - if ( !pPartial.compare_exchange_strong(pCur, pDesc, atomics::memory_order_acq_rel, atomics::memory_order_relaxed) ) + if ( !pPartial.compare_exchange_strong(pCur, pDesc, atomics::memory_order_acq_rel, atomics::memory_order_relaxed)) partialList.push( pDesc ); } @@ -1205,7 +1205,7 @@ namespace michael { /// Allocates large block from system memory block_header * alloc_from_OS( size_t nSize ) { - block_header * p = reinterpret_cast( m_LargeHeap.alloc( nSize ) ); + block_header * p = reinterpret_cast( m_LargeHeap.alloc( nSize )); m_OSAllocStat.incBytesAllocated( nSize ); p->setOSAllocated( nSize ); return p; @@ -1221,7 +1221,7 @@ namespace michael { while ( true ) { ++nCollision; oldActive = pProcHeap->active.load(atomics::memory_order_acquire); - if ( !oldActive.ptr() ) + if ( !oldActive.ptr()) return nullptr; unsigned int nCredits = oldActive.credits(); active_tag newActive ; // default = 0 @@ -1284,8 +1284,8 @@ namespace michael { // block_header fields is not needed to setup // It was set in alloc_from_new_superblock assert( reinterpret_cast( pAddr )->desc() == pDesc ); - assert( !reinterpret_cast( pAddr )->isOSAllocated() ); - assert( !reinterpret_cast( pAddr )->isAligned() ); + assert( !reinterpret_cast( pAddr )->isOSAllocated()); + assert( !reinterpret_cast( pAddr )->isAligned()); return reinterpret_cast( pAddr ); } @@ -1318,7 +1318,7 @@ namespace michael { newAnchor.count -= nMoreCredits + 1; newAnchor.state = (nMoreCredits > 0) ? SBSTATE_ACTIVE : SBSTATE_FULL; newAnchor.tag += 1; - } while ( !pDesc->anchor.compare_exchange_strong(oldAnchor, newAnchor, atomics::memory_order_release, atomics::memory_order_relaxed) ); + } while ( !pDesc->anchor.compare_exchange_strong(oldAnchor, newAnchor, atomics::memory_order_release, atomics::memory_order_relaxed)); if ( nCollision ) pProcHeap->stat.incPartialDescCASFailureCount( nCollision ); @@ -1339,7 +1339,7 @@ namespace michael { pAddr = pDesc->pSB + oldAnchor.avail * pDesc->nBlockSize; newAnchor.avail = reinterpret_cast( pAddr )->nNextFree; ++newAnchor.tag; - } while ( !pDesc->anchor.compare_exchange_strong(oldAnchor, newAnchor, atomics::memory_order_release, atomics::memory_order_relaxed) ); + } while ( !pDesc->anchor.compare_exchange_strong(oldAnchor, newAnchor, atomics::memory_order_release, atomics::memory_order_relaxed)); if ( nCollision ) pProcHeap->stat.incPartialAnchorCASFailureCount( nCollision ); @@ -1354,8 +1354,8 @@ namespace michael { // block_header fields is not needed to setup // It was set in alloc_from_new_superblock assert( reinterpret_cast( pAddr )->desc() == pDesc ); - assert( !reinterpret_cast( pAddr )->isAligned() ); - assert( !reinterpret_cast( pAddr )->isOSAllocated() ); + assert( !reinterpret_cast( pAddr )->isAligned()); + assert( !reinterpret_cast( pAddr )->isOSAllocated()); return reinterpret_cast( pAddr ); } @@ -1401,7 +1401,7 @@ namespace michael { /// Find appropriate processor heap based on size-class selected processor_heap * find_heap( typename sizeclass_selector::sizeclass_index nSizeClassIndex ) { - assert( nSizeClassIndex < m_SizeClassSelector.size() ); + assert( nSizeClassIndex < m_SizeClassSelector.size()); unsigned int nProcessorId = m_Topology.current_processor(); assert( nProcessorId < m_nProcessorCount ); @@ -1413,7 +1413,7 @@ namespace michael { while ( !pDesc ) { processor_desc * pNewDesc = new_processor_desc( nProcessorId ); - if ( m_arrProcDesc[nProcessorId].compare_exchange_strong( pDesc, pNewDesc, atomics::memory_order_release, atomics::memory_order_relaxed ) ) { + if ( m_arrProcDesc[nProcessorId].compare_exchange_strong( pDesc, pNewDesc, atomics::memory_order_release, atomics::memory_order_relaxed )) { pDesc = pNewDesc; break; } @@ -1432,7 +1432,7 @@ namespace michael { active_tag newActive; newActive.set( pDesc, nCredits - 1 ); - if ( pProcHeap->active.compare_exchange_strong( nullActive, newActive, atomics::memory_order_seq_cst, atomics::memory_order_relaxed ) ) + if ( pProcHeap->active.compare_exchange_strong( nullActive, newActive, atomics::memory_order_seq_cst, atomics::memory_order_relaxed )) return; // Someone installed another active superblock. @@ -1486,7 +1486,7 @@ namespace michael { // TSan false positive: a new descriptor will be linked further with release fence CDS_TSAN_ANNOTATE_IGNORE_WRITES_BEGIN; - pDesc = new( m_AlignedHeap.alloc( szTotal, c_nAlignment ) ) processor_desc; + pDesc = new( m_AlignedHeap.alloc( szTotal, c_nAlignment )) processor_desc; pDesc->pageHeaps = reinterpret_cast( pDesc + 1 ); for ( size_t i = 0; i < nPageHeapCount; ++i ) @@ -1575,7 +1575,7 @@ namespace michael { anchor_tag anchor; superblock_desc * pDesc = pProcHeap->pProcDesc->listSBDescFree.pop(); if ( pDesc == nullptr ) { - pDesc = new( m_AlignedHeap.alloc(sizeof(superblock_desc), c_nAlignment ) ) superblock_desc; + pDesc = new( m_AlignedHeap.alloc(sizeof(superblock_desc), c_nAlignment )) superblock_desc; assert( (uintptr_t(pDesc) & (c_nAlignment - 1)) == 0 ); anchor = pDesc->anchor.load( atomics::memory_order_relaxed ); @@ -1631,7 +1631,7 @@ namespace michael { if ( nSizeClassIndex == sizeclass_selector::c_nNoSizeClass ) { return alloc_from_OS( nSize ); } - assert( nSizeClassIndex < m_SizeClassSelector.size() ); + assert( nSizeClassIndex < m_SizeClassSelector.size()); block_header * pBlock; processor_heap * pProcHeap; @@ -1694,7 +1694,7 @@ namespace michael { block_header * pBlock = int_alloc( nSize + sizeof(block_header) + bound_checker::trailer_size ); // Bound checking is only for our blocks - if ( !pBlock->isOSAllocated() ) { + if ( !pBlock->isOSAllocated()) { // the block is allocated from our heap - bound checker is applicable m_BoundChecker.make_trailer( reinterpret_cast(pBlock + 1), @@ -1718,14 +1718,14 @@ namespace michael { block_header * pRedirect = (reinterpret_cast( pMemory ) - 1); block_header * pBlock = pRedirect->begin(); - if ( pBlock->isOSAllocated() ) { + if ( pBlock->isOSAllocated()) { // Block has been allocated from OS - m_OSAllocStat.incBytesDeallocated( pBlock->getOSAllocSize() ); + m_OSAllocStat.incBytesDeallocated( pBlock->getOSAllocSize()); m_LargeHeap.free( pBlock ); return; } - assert( !pBlock->isAligned() ); + assert( !pBlock->isAligned()); superblock_desc * pDesc = pBlock->desc(); m_BoundChecker.check_bounds( @@ -1760,7 +1760,7 @@ namespace michael { } else newAnchor.count += 1; - } while ( !pDesc->anchor.compare_exchange_strong( oldAnchor, newAnchor, atomics::memory_order_release, atomics::memory_order_relaxed ) ); + } while ( !pDesc->anchor.compare_exchange_strong( oldAnchor, newAnchor, atomics::memory_order_release, atomics::memory_order_relaxed )); pProcHeap->stat.incFreeCount(); @@ -1802,12 +1802,12 @@ namespace michael { block_header * pBlock = reinterpret_cast( pMemory ) - 1; // Reallocation of aligned block is not possible - if ( pBlock->isAligned() ) { + if ( pBlock->isAligned()) { assert( false ); return nullptr; } - if ( pBlock->isOSAllocated() ) { + if ( pBlock->isOSAllocated()) { // The block has been allocated from OS size_t nCurSize = pBlock->getOSAllocSize(); @@ -1817,7 +1817,7 @@ namespace michael { // Grow block size void * pNewBuf = alloc( nOrigSize ); if ( pNewBuf ) { - memcpy( pNewBuf, pMemory, nCurSize - sizeof(block_header) ); + memcpy( pNewBuf, pMemory, nCurSize - sizeof(block_header)); free( pMemory ); } return pNewBuf; @@ -1837,7 +1837,7 @@ namespace michael { void * pNew = alloc( nNewSize ); if ( pNew ) { - memcpy( pNew, pMemory, pDesc->nBlockSize - sizeof(block_header) ); + memcpy( pNew, pMemory, pDesc->nBlockSize - sizeof(block_header)); free( pMemory ); return pNew; } @@ -1872,7 +1872,7 @@ namespace michael { // Bound checking is only for our blocks - if ( !pBlock->isOSAllocated() ) { + if ( !pBlock->isOSAllocated()) { // the block is allocated from our heap - bound checker is applicable m_BoundChecker.make_trailer( reinterpret_cast(pRedirect + 1), diff --git a/cds/memory/michael/bound_check.h b/cds/memory/michael/bound_check.h index 80da4485..e10365f4 100644 --- a/cds/memory/michael/bound_check.h +++ b/cds/memory/michael/bound_check.h @@ -56,7 +56,7 @@ namespace cds { namespace memory { namespace michael { assert( reinterpret_cast(pEndBlock) - (pArea + nAllocSize) >= trailer_size ); trailer_type trailer = s_BoundCheckerTrailer; - memcpy( pArea + nAllocSize, &trailer, sizeof(trailer) ); + memcpy( pArea + nAllocSize, &trailer, sizeof(trailer)); // the next assignment is correct because pBlock is at least sizeof(size_t)-byte aligned assert( (reinterpret_cast(pEndBlock) & (sizeof(size_t) - 1)) == 0 ); @@ -70,7 +70,7 @@ namespace cds { namespace memory { namespace michael { assert( nAllocSize < nBlockSize ); return nAllocSize < nBlockSize - && memcmp( reinterpret_cast(pStartArea) + nAllocSize, &trailer, sizeof(trailer) ) == 0; + && memcmp( reinterpret_cast(pStartArea) + nAllocSize, &trailer, sizeof(trailer)) == 0; } }; } @@ -91,7 +91,7 @@ namespace cds { namespace memory { namespace michael { void check_bounds( void * pStartArea, void * pEndBlock, size_t nBlockSize ) { // Bound checking assertion - assert( base_class::check_bounds( pStartArea, pEndBlock, nBlockSize ) ); + assert( base_class::check_bounds( pStartArea, pEndBlock, nBlockSize )); } //@endcond @@ -126,7 +126,7 @@ namespace cds { namespace memory { namespace michael { public: void check_bounds( void * pStartArea, void * pEndBlock, size_t nBlockSize ) { - if ( !base_class::check_bounds( pStartArea, pEndBlock, nBlockSize ) ) { + if ( !base_class::check_bounds( pStartArea, pEndBlock, nBlockSize )) { throw bound_checker_exception(); } } diff --git a/cds/memory/vyukov_queue_pool.h b/cds/memory/vyukov_queue_pool.h index 9821a892..65c2e78f 100644 --- a/cds/memory/vyukov_queue_pool.h +++ b/cds/memory/vyukov_queue_pool.h @@ -135,7 +135,7 @@ namespace cds { namespace memory { //@cond void preallocate_pool() { - m_pFirst = std_allocator().allocate( m_Queue.capacity() ); + m_pFirst = std_allocator().allocate( m_Queue.capacity()); m_pLast = m_pFirst + m_Queue.capacity(); for ( value_type * p = m_pFirst; p < m_pLast; ++p ) { @@ -184,7 +184,7 @@ namespace cds { namespace memory { value_type * p = m_Queue.pop(); if ( p ) { - assert( from_pool(p) ); + assert( from_pool(p)); return new( p ) value_type; } // The pool is empty - allocate new from the heap @@ -205,7 +205,7 @@ namespace cds { namespace memory { CDS_UNUSED(n); if ( p ) { - if ( from_pool(p) ) { + if ( from_pool(p)) { p->~value_type(); // The queue can notify about false fullness state // so we push in loop @@ -309,7 +309,7 @@ namespace cds { namespace memory { ~lazy_vyukov_queue_pool() { std_allocator a; - while ( !m_Queue.empty() ) + while ( !m_Queue.empty()) a.deallocate( m_Queue.pop(), 1 ); } @@ -502,7 +502,7 @@ namespace cds { namespace memory { if ( !p ) { back_off bkoff; - while ( m_Queue.size() ) { + while ( m_Queue.size()) { p = m_Queue.pop(); if ( p ) goto ok; @@ -514,7 +514,7 @@ namespace cds { namespace memory { } ok: - assert( from_pool(p) ); + assert( from_pool(p)); return p; } @@ -535,7 +535,7 @@ namespace cds { namespace memory { back_off bkoff; // The queue can notify it is full but that is false fullness state // So, we push in loop - while ( !m_Queue.push(*p) ) + while ( !m_Queue.push(*p)) bkoff(); } } diff --git a/cds/opt/buffer.h b/cds/opt/buffer.h index 36e86195..db89d15c 100644 --- a/cds/opt/buffer.h +++ b/cds/opt/buffer.h @@ -139,14 +139,14 @@ namespace cds { namespace opt { /// Get item \p i value_type& operator []( size_t i ) { - assert( i < capacity() ); + assert( i < capacity()); return m_buffer[i].v; } /// Get item \p i, const version const value_type& operator []( size_t i ) const { - assert( i < capacity() ); + assert( i < capacity()); return m_buffer[i].v; } @@ -159,7 +159,7 @@ namespace cds { namespace opt { /// Zeroize the buffer void zeroize() { - memset( m_buffer, 0, capacity() * sizeof(m_buffer[0]) ); + memset( m_buffer, 0, capacity() * sizeof(m_buffer[0])); } /// Returns pointer to buffer array @@ -231,14 +231,14 @@ namespace cds { namespace opt { /// Get item \p i value_type& operator []( size_t i ) { - assert( i < capacity() ); + assert( i < capacity()); return m_buffer[i]; } /// Get item \p i, const version const value_type& operator []( size_t i ) const { - assert( i < capacity() ); + assert( i < capacity()); return m_buffer[i]; } @@ -251,7 +251,7 @@ namespace cds { namespace opt { /// Zeroize the buffer void zeroize() { - memset( m_buffer, 0, capacity() * sizeof(m_buffer[0]) ); + memset( m_buffer, 0, capacity() * sizeof(m_buffer[0])); } /// Returns pointer to buffer array @@ -333,14 +333,14 @@ namespace cds { namespace opt { /// Get item \p i value_type& operator []( size_t i ) { - assert( i < capacity() ); + assert( i < capacity()); return m_buffer[i]; } /// Get item \p i, const version const value_type& operator []( size_t i ) const { - assert( i < capacity() ); + assert( i < capacity()); return m_buffer[i]; } @@ -353,7 +353,7 @@ namespace cds { namespace opt { /// Zeroize the buffer void zeroize() { - memset( m_buffer, 0, capacity() * sizeof(m_buffer[0]) ); + memset( m_buffer, 0, capacity() * sizeof(m_buffer[0])); } /// Returns pointer to buffer array @@ -437,14 +437,14 @@ namespace cds { namespace opt { /// Get item \p i value_type& operator []( size_t i ) { - assert( i < capacity() ); + assert( i < capacity()); return m_buffer[i]; } /// Get item \p i, const version const value_type& operator []( size_t i ) const { - assert( i < capacity() ); + assert( i < capacity()); return m_buffer[i]; } @@ -457,7 +457,7 @@ namespace cds { namespace opt { /// Zeroize the buffer void zeroize() { - memset( m_buffer, 0, capacity() * sizeof(m_buffer[0]) ); + memset( m_buffer, 0, capacity() * sizeof(m_buffer[0])); } /// Returns pointer to buffer array diff --git a/cds/opt/compare.h b/cds/opt/compare.h index 70f951dc..921be9bb 100644 --- a/cds/opt/compare.h +++ b/cds/opt/compare.h @@ -93,7 +93,7 @@ namespace cds { namespace opt { /// Operator that compares two value of type \p T int operator()(T const& v1, T const& v2) { - if ( std::less()( v1, v2 ) ) + if ( std::less()( v1, v2 )) return -1; if ( std::less()( v2, v1 )) return 1; @@ -186,9 +186,9 @@ namespace cds { namespace opt { int operator ()( T const& t, Q const& q ) const { less_functor f; - if ( f( t, q ) ) + if ( f( t, q )) return -1; - if ( f( q, t ) ) + if ( f( q, t )) return 1; return 0; } diff --git a/cds/opt/hash.h b/cds/opt/hash.h index ec0e5aa7..bbe0027e 100644 --- a/cds/opt/hash.h +++ b/cds/opt/hash.h @@ -107,7 +107,7 @@ namespace cds { namespace opt { : hash_tuple( t ) {} hash_list( hash_tuple_type&& t) - : hash_tuple( std::forward(t) ) + : hash_tuple( std::forward(t)) {} template @@ -172,7 +172,7 @@ namespace cds { namespace opt { : m_wrappedList( t ) {} hash_list_wrapper( hash_tuple_type&& t) - : m_wrappedList( std::forward(t) ) + : m_wrappedList( std::forward(t)) {} void operator()( size_t * dest, wrapped_type const& what ) const diff --git a/cds/opt/permutation.h b/cds/opt/permutation.h index b1da69d8..a45a58b6 100644 --- a/cds/opt/permutation.h +++ b/cds/opt/permutation.h @@ -71,14 +71,14 @@ namespace cds { namespace opt { do { int i = gen; //... - } while ( gen.next() ); + } while ( gen.next()); // Get other permutation gen.reset(); do { int i = gen; //... - } while ( gen.next() ); + } while ( gen.next()); \endcode The following \p Generator defined: @@ -126,7 +126,7 @@ namespace cds { namespace opt { random_permutation( size_t nLength ) : m_nCur(0) , m_nStart(0) - , m_nMod( integer_type(nLength) ) + , m_nMod( integer_type(nLength)) { reset(); } @@ -146,7 +146,7 @@ namespace cds { namespace opt { /// Resets the generator to produce new sequence void reset() { - m_nCur = m_nStart = integer_type( std::rand() ) % m_nMod; + m_nCur = m_nStart = integer_type( std::rand()) % m_nMod; } }; @@ -204,7 +204,7 @@ namespace cds { namespace opt { /// Resets the generator to produce new sequence void reset() { - m_nCur = m_nStart = integer_type( std::rand() ) & m_nMask; + m_nCur = m_nStart = integer_type( std::rand()) & m_nMask; } }; diff --git a/cds/os/aix/timer.h b/cds/os/aix/timer.h index 67f689db..97544245 100644 --- a/cds/os/aix/timer.h +++ b/cds/os/aix/timer.h @@ -58,7 +58,7 @@ namespace cds { namespace OS { typedef timebasestruct_t native_timer_type; typedef long long native_duration_type; - Timer() : m_tmStart( current() ) {} + Timer() : m_tmStart( current()) {} static native_timer_type current() { @@ -68,7 +68,7 @@ namespace cds { namespace OS { } static void current( native_timer_type& tmr ) { - read_real_time( &tmr, sizeof(tmr) ); + read_real_time( &tmr, sizeof(tmr)); time_base_to_time( &tmr, sizeof(tmr )); } @@ -88,12 +88,12 @@ namespace cds { namespace OS { double duration() { - return duration( native_duration() ); + return duration( native_duration()); } native_duration_type native_duration() { - return native_duration( m_tmStart, current() ); + return native_duration( m_tmStart, current()); } static native_duration_type native_duration( native_timer_type const & nStart, native_timer_type const & nEnd ) @@ -104,7 +104,7 @@ namespace cds { namespace OS { static unsigned long long random_seed() { native_timer_type tmr; - read_real_time( &tmr, sizeof(tmr) ); + read_real_time( &tmr, sizeof(tmr)); return ( ((unsigned long long)(tmr.tb_hight)) << 32 ) + tmr.tb_low; } }; diff --git a/cds/os/alloc_aligned.h b/cds/os/alloc_aligned.h index 4ac481e0..65625d83 100644 --- a/cds/os/alloc_aligned.h +++ b/cds/os/alloc_aligned.h @@ -174,8 +174,8 @@ namespace cds { */ pointer allocate( size_type nAlign, size_type nCount ) { - assert( cds::beans::is_power2( nAlign ) ); - pointer p = reinterpret_cast( cds::OS::aligned_malloc( sizeof(T) * nCount, nAlign ) ); + assert( cds::beans::is_power2( nAlign )); + pointer p = reinterpret_cast( cds::OS::aligned_malloc( sizeof(T) * nCount, nAlign )); if ( !p ) throw std::bad_alloc(); assert( cds::details::is_aligned( p, nAlign )); @@ -191,7 +191,7 @@ namespace cds { */ pointer allocate(size_type nAlign, size_type nCount, const void *) { - return ( allocate( nAlign, nCount ) ); + return ( allocate( nAlign, nCount )); } /// construct object at \p ptr with value \p val diff --git a/cds/os/free_bsd/timer.h b/cds/os/free_bsd/timer.h index 3bbdac21..67be0c9f 100644 --- a/cds/os/free_bsd/timer.h +++ b/cds/os/free_bsd/timer.h @@ -89,7 +89,7 @@ namespace cds { namespace OS { double duration() { - return duration( native_duration() ); + return duration( native_duration()); } native_duration_type native_duration() diff --git a/cds/os/linux/timer.h b/cds/os/linux/timer.h index a62d0a20..795f96ed 100644 --- a/cds/os/linux/timer.h +++ b/cds/os/linux/timer.h @@ -84,7 +84,7 @@ namespace cds { namespace OS { double duration() { - return duration( native_duration() ); + return duration( native_duration()); } native_duration_type native_duration() diff --git a/cds/os/osx/timer.h b/cds/os/osx/timer.h index 634913ed..f5cb353e 100644 --- a/cds/os/osx/timer.h +++ b/cds/os/osx/timer.h @@ -96,7 +96,7 @@ namespace cds { namespace OS { double duration() { - return duration( native_duration() ); + return duration( native_duration()); } native_duration_type native_duration() diff --git a/cds/os/posix/timer.h b/cds/os/posix/timer.h index 4a511fd5..ad8a9050 100644 --- a/cds/os/posix/timer.h +++ b/cds/os/posix/timer.h @@ -83,7 +83,7 @@ namespace cds { namespace OS { double duration() { - return duration( native_duration() ); + return duration( native_duration()); } native_duration_type native_duration() diff --git a/cds/os/sunos/timer.h b/cds/os/sunos/timer.h index aebf04cb..970a699a 100644 --- a/cds/os/sunos/timer.h +++ b/cds/os/sunos/timer.h @@ -48,7 +48,7 @@ namespace cds { namespace OS { typedef hrtime_t native_timer_type; typedef long long native_duration_type; - Timer() : m_tmStart( current() ) {} + Timer() : m_tmStart( current()) {} static native_timer_type current() { return gethrtime(); } static void current( native_timer_type& tmr ) { tmr = gethrtime(); } @@ -68,12 +68,12 @@ namespace cds { namespace OS { double duration() { - return duration( native_duration() ); + return duration( native_duration()); } native_duration_type native_duration() { - return native_duration( m_tmStart, current() ); + return native_duration( m_tmStart, current()); } static native_duration_type native_duration( native_timer_type nStart, native_timer_type nEnd ) diff --git a/cds/os/win/timer.h b/cds/os/win/timer.h index 85839b18..ea6e24af 100644 --- a/cds/os/win/timer.h +++ b/cds/os/win/timer.h @@ -98,7 +98,7 @@ namespace cds { namespace OS { /// Returns duration (in seconds) from start time to current double duration() { - return duration( native_duration() ); + return duration( native_duration()); } /// Returns duration (in native format) from start time to current diff --git a/cds/sync/lock_array.h b/cds/sync/lock_array.h index aba10a7f..4c0f07db 100644 --- a/cds/sync/lock_array.h +++ b/cds/sync/lock_array.h @@ -232,15 +232,15 @@ namespace cds { namespace sync { /// Locks a lock at cell \p hint /** To define real array's cell which should be locked, \ref select_cell_policy is used. - The target cell is a result of select_cell_policy( hint, size() ). + The target cell is a result of select_cell_policy( hint, size()). Returns the index of locked lock. */ template size_t lock( Q const& hint ) { - size_t nCell = m_SelectCellPolicy( hint, size() ); - assert( nCell < size() ); + size_t nCell = m_SelectCellPolicy( hint, size()); + assert( nCell < size()); m_arrLocks[nCell].lock(); return nCell; } @@ -248,16 +248,16 @@ namespace cds { namespace sync { /// Try lock a lock at cell \p hint /** To define real array's cell which should be locked, \ref select_cell_policy is used. - The target cell is a result of select_cell_policy( hint, size() ). + The target cell is a result of select_cell_policy( hint, size()). Returns the index of locked lock if success, \ref c_nUnspecifiedCell constant otherwise. */ template size_t try_lock( Q const& hint ) { - size_t nCell = m_SelectCellPolicy( hint, size() ); - assert( nCell < size() ); - if ( m_arrLocks[nCell].try_lock() ) + size_t nCell = m_SelectCellPolicy( hint, size()); + assert( nCell < size()); + if ( m_arrLocks[nCell].try_lock()) return nCell; return c_nUnspecifiedCell; } @@ -265,7 +265,7 @@ namespace cds { namespace sync { /// Unlock the lock specified by index \p nCell void unlock( size_t nCell ) { - assert( nCell < size() ); + assert( nCell < size()); m_arrLocks[nCell].unlock(); } @@ -291,7 +291,7 @@ namespace cds { namespace sync { */ lock_type& at( size_t nCell ) const { - assert( nCell < size() ); + assert( nCell < size()); return m_arrLocks[ nCell ]; } @@ -325,7 +325,7 @@ namespace std { template unique_lock( lock_array_type& arrLocks, Q const& hint ) : m_arrLocks( arrLocks ) - , m_nLockGuarded( arrLocks.lock( hint ) ) + , m_nLockGuarded( arrLocks.lock( hint )) {} /// Locks all from \p arrLocks array diff --git a/cds/sync/pool_monitor.h b/cds/sync/pool_monitor.h index 4bb160fe..c9447cbe 100644 --- a/cds/sync/pool_monitor.h +++ b/cds/sync/pool_monitor.h @@ -84,7 +84,7 @@ namespace cds { namespace sync { { ++m_nLockAllocation; int nDiff = static_cast( m_nLockAllocation.get() - m_nLockDeallocation.get()); - if ( nDiff > 0 && m_nMaxAllocated.get() < static_cast( nDiff ) ) + if ( nDiff > 0 && m_nMaxAllocated.get() < static_cast( nDiff )) m_nMaxAllocated = static_cast( nDiff ); } void onLockDeallocation() { ++m_nLockDeallocation;} @@ -195,7 +195,7 @@ namespace cds { namespace sync { // try lock spin and increment reference counter refspin_type cur = p.m_SyncMonitorInjection.m_RefSpin.load( atomics::memory_order_relaxed ) & ~c_nSpinBit; if ( !p.m_SyncMonitorInjection.m_RefSpin.compare_exchange_weak( cur, cur + c_nRefIncrement + c_nSpinBit, - atomics::memory_order_acquire, atomics::memory_order_relaxed ) ) + atomics::memory_order_acquire, atomics::memory_order_relaxed )) { back_off bkoff; do { @@ -237,7 +237,7 @@ namespace cds { namespace sync { // try lock spin refspin_type cur = p.m_SyncMonitorInjection.m_RefSpin.load( atomics::memory_order_relaxed ) & ~c_nSpinBit; if ( !p.m_SyncMonitorInjection.m_RefSpin.compare_exchange_weak( cur, cur | c_nSpinBit, - atomics::memory_order_acquire, atomics::memory_order_relaxed ) ) + atomics::memory_order_acquire, atomics::memory_order_relaxed )) { back_off bkoff; do { diff --git a/cds/sync/spinlock.h b/cds/sync/spinlock.h index dec82321..1708bba0 100644 --- a/cds/sync/spinlock.h +++ b/cds/sync/spinlock.h @@ -111,7 +111,7 @@ namespace cds { /// Destructor. On debug time it checks whether spin-lock is free ~spin_lock() { - assert( !m_spin.load( atomics::memory_order_relaxed ) ); + assert( !m_spin.load( atomics::memory_order_relaxed )); } /// Check if the spin is locked @@ -145,11 +145,11 @@ namespace cds { Returns \p true if locking is succeeded otherwise (if the spin is already locked) returns \p false */ - bool try_lock( unsigned int nTryCount ) CDS_NOEXCEPT_( noexcept( backoff_strategy()() ) ) + bool try_lock( unsigned int nTryCount ) CDS_NOEXCEPT_( noexcept( backoff_strategy()()) ) { backoff_strategy backoff; while ( nTryCount-- ) { - if ( try_lock() ) + if ( try_lock()) return true; backoff(); } @@ -157,28 +157,28 @@ namespace cds { } /// Lock the spin-lock. Waits infinitely while spin-lock is locked. Debug version: deadlock may be detected - void lock() CDS_NOEXCEPT_(noexcept( backoff_strategy()() )) + void lock() CDS_NOEXCEPT_(noexcept( backoff_strategy()())) { backoff_strategy backoff; // Deadlock detected - assert( m_dbgOwnerId != OS::get_current_thread_id() ); + assert( m_dbgOwnerId != OS::get_current_thread_id()); // TATAS algorithm - while ( !try_lock() ) { - while ( m_spin.load( atomics::memory_order_relaxed ) ) { + while ( !try_lock()) { + while ( m_spin.load( atomics::memory_order_relaxed )) { backoff(); } } - assert( m_dbgOwnerId == OS::get_current_thread_id() ); + assert( m_dbgOwnerId == OS::get_current_thread_id()); } /// Unlock the spin-lock. Debug version: deadlock may be detected void unlock() CDS_NOEXCEPT { - assert( m_spin.load( atomics::memory_order_relaxed ) ); + assert( m_spin.load( atomics::memory_order_relaxed )); - assert( m_dbgOwnerId == OS::get_current_thread_id() ); + assert( m_dbgOwnerId == OS::get_current_thread_id()); CDS_DEBUG_ONLY( m_dbgOwnerId = OS::c_NullThreadId; ) m_spin.store( false, atomics::memory_order_release ); @@ -241,24 +241,24 @@ namespace cds { return m_spin.compare_exchange_weak( nCurrent, 1, atomics::memory_order_acquire, atomics::memory_order_relaxed ); } - bool try_acquire( unsigned int nTryCount ) CDS_NOEXCEPT_( noexcept( backoff_strategy()() )) + bool try_acquire( unsigned int nTryCount ) CDS_NOEXCEPT_( noexcept( backoff_strategy()())) { backoff_strategy bkoff; while ( nTryCount-- ) { - if ( try_acquire() ) + if ( try_acquire()) return true; bkoff(); } return false; } - void acquire() CDS_NOEXCEPT_( noexcept( backoff_strategy()() )) + void acquire() CDS_NOEXCEPT_( noexcept( backoff_strategy()())) { // TATAS algorithm backoff_strategy bkoff; - while ( !try_acquire() ) { - while ( m_spin.load( atomics::memory_order_relaxed ) ) + while ( !try_acquire()) { + while ( m_spin.load( atomics::memory_order_relaxed )) bkoff(); } } @@ -298,14 +298,14 @@ namespace cds { */ bool is_locked() const CDS_NOEXCEPT { - return !( m_spin.load( atomics::memory_order_relaxed ) == 0 || is_taken( cds::OS::get_current_thread_id() )); + return !( m_spin.load( atomics::memory_order_relaxed ) == 0 || is_taken( cds::OS::get_current_thread_id())); } /// Try to lock the spin-lock (synonym for \p try_lock()) bool try_lock() CDS_NOEXCEPT { thread_id tid = OS::get_current_thread_id(); - if ( try_taken_lock( tid ) ) + if ( try_taken_lock( tid )) return true; if ( try_acquire()) { take( tid ); @@ -318,7 +318,7 @@ namespace cds { bool try_lock( unsigned int nTryCount ) CDS_NOEXCEPT_( noexcept( std::declval().try_acquire( nTryCount ))) { thread_id tid = OS::get_current_thread_id(); - if ( try_taken_lock( tid ) ) + if ( try_taken_lock( tid )) return true; if ( try_acquire( nTryCount )) { take( tid ); @@ -331,7 +331,7 @@ namespace cds { void lock() CDS_NOEXCEPT_( noexcept( std::declval().acquire())) { thread_id tid = OS::get_current_thread_id(); - if ( !try_taken_lock( tid ) ) { + if ( !try_taken_lock( tid )) { acquire(); take( tid ); } @@ -340,7 +340,7 @@ namespace cds { /// Unlock the spin-lock. Return \p true if the current thread is owner of spin-lock \p false otherwise bool unlock() CDS_NOEXCEPT { - if ( is_taken( OS::get_current_thread_id() ) ) { + if ( is_taken( OS::get_current_thread_id()) ) { integral_type n = m_spin.load( atomics::memory_order_relaxed ); if ( n > 1 ) m_spin.store( n - 1, atomics::memory_order_relaxed ); @@ -356,7 +356,7 @@ namespace cds { /// Change the owner of locked spin-lock. May be called by thread that is owner of the spin-lock bool change_owner( OS::ThreadId newOwnerId ) CDS_NOEXCEPT { - if ( is_taken( OS::get_current_thread_id() ) ) { + if ( is_taken( OS::get_current_thread_id()) ) { assert( newOwnerId != OS::c_NullThreadId ); m_OwnerId = newOwnerId; return true; diff --git a/cds/threading/details/_common.h b/cds/threading/details/_common.h index a1e98020..dcc1faf0 100644 --- a/cds/threading/details/_common.h +++ b/cds/threading/details/_common.h @@ -82,10 +82,10 @@ namespace cds { \code class Manager { public: - // Initialize manager (called by cds::Initialize() ) + // Initialize manager (called by cds::Initialize()) static void init(); - // Terminate manager (called by cds::Terminate() ) + // Terminate manager (called by cds::Terminate()) static void fini(); // Checks whether current thread is attached to \p libcds feature or not. @@ -179,12 +179,12 @@ namespace cds { , m_nFakeProcessorNumber( s_nLastUsedProcNo.fetch_add(1, atomics::memory_order_relaxed) % s_nProcCount ) , m_nAttachCount(0) { - if (cds::gc::HP::isUsed() ) + if (cds::gc::HP::isUsed()) m_hpManager = new (m_hpManagerPlaceholder) cds::gc::HP::thread_gc_impl; else m_hpManager = nullptr; - if ( cds::gc::DHP::isUsed() ) + if ( cds::gc::DHP::isUsed()) m_dhpManager = new (m_dhpManagerPlaceholder) cds::gc::DHP::thread_gc_impl; else m_dhpManager = nullptr; @@ -216,21 +216,21 @@ namespace cds { void init() { if ( m_nAttachCount++ == 0 ) { - if ( cds::gc::HP::isUsed() ) + if ( cds::gc::HP::isUsed()) m_hpManager->init(); - if ( cds::gc::DHP::isUsed() ) + if ( cds::gc::DHP::isUsed()) m_dhpManager->init(); - if ( cds::urcu::details::singleton::isUsed() ) + if ( cds::urcu::details::singleton::isUsed()) m_pGPIRCU = cds::urcu::details::singleton::attach_thread(); - if ( cds::urcu::details::singleton::isUsed() ) + if ( cds::urcu::details::singleton::isUsed()) m_pGPBRCU = cds::urcu::details::singleton::attach_thread(); - if ( cds::urcu::details::singleton::isUsed() ) + if ( cds::urcu::details::singleton::isUsed()) m_pGPTRCU = cds::urcu::details::singleton::attach_thread(); #ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED - if ( cds::urcu::details::singleton::isUsed() ) + if ( cds::urcu::details::singleton::isUsed()) m_pSHBRCU = cds::urcu::details::singleton::attach_thread(); - if ( cds::urcu::details::singleton::isUsed() ) + if ( cds::urcu::details::singleton::isUsed()) m_pSHTRCU = cds::urcu::details::singleton::attach_thread(); #endif } @@ -239,29 +239,29 @@ namespace cds { bool fini() { if ( --m_nAttachCount == 0 ) { - if ( cds::gc::DHP::isUsed() ) + if ( cds::gc::DHP::isUsed()) m_dhpManager->fini(); - if ( cds::gc::HP::isUsed() ) + if ( cds::gc::HP::isUsed()) m_hpManager->fini(); - if ( cds::urcu::details::singleton::isUsed() ) { + if ( cds::urcu::details::singleton::isUsed()) { cds::urcu::details::singleton::detach_thread( m_pGPIRCU ); m_pGPIRCU = nullptr; } - if ( cds::urcu::details::singleton::isUsed() ) { + if ( cds::urcu::details::singleton::isUsed()) { cds::urcu::details::singleton::detach_thread( m_pGPBRCU ); m_pGPBRCU = nullptr; } - if ( cds::urcu::details::singleton::isUsed() ) { + if ( cds::urcu::details::singleton::isUsed()) { cds::urcu::details::singleton::detach_thread( m_pGPTRCU ); m_pGPTRCU = nullptr; } #ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED - if ( cds::urcu::details::singleton::isUsed() ) { + if ( cds::urcu::details::singleton::isUsed()) { cds::urcu::details::singleton::detach_thread( m_pSHBRCU ); m_pSHBRCU = nullptr; } - if ( cds::urcu::details::singleton::isUsed() ) { + if ( cds::urcu::details::singleton::isUsed()) { cds::urcu::details::singleton::detach_thread( m_pSHTRCU ); m_pSHTRCU = nullptr; } diff --git a/cds/threading/details/cxx11_manager.h b/cds/threading/details/cxx11_manager.h index b758e3a3..9bac4941 100644 --- a/cds/threading/details/cxx11_manager.h +++ b/cds/threading/details/cxx11_manager.h @@ -109,9 +109,9 @@ namespace cds { namespace threading { /// This method must be called in end of thread execution static void detachThread() { - assert( _threadData() ); + assert( _threadData()); - if ( _threadData()->fini() ) + if ( _threadData()->fini()) destroy_thread_data(); } diff --git a/cds/threading/details/gcc_manager.h b/cds/threading/details/gcc_manager.h index b69f0ed6..e86ec737 100644 --- a/cds/threading/details/gcc_manager.h +++ b/cds/threading/details/gcc_manager.h @@ -109,9 +109,9 @@ namespace cds { namespace threading { /// This method must be called in end of thread execution static void detachThread() { - assert( _threadData() ); + assert( _threadData()); - if ( _threadData()->fini() ) + if ( _threadData()->fini()) destroy_thread_data(); } diff --git a/cds/threading/details/msvc_manager.h b/cds/threading/details/msvc_manager.h index 191158a9..966dba22 100644 --- a/cds/threading/details/msvc_manager.h +++ b/cds/threading/details/msvc_manager.h @@ -109,9 +109,9 @@ namespace cds { namespace threading { /// This method must be called in end of thread execution static void detachThread() { - assert( _threadData() ); + assert( _threadData()); - if ( _threadData()->fini() ) + if ( _threadData()->fini()) destroy_thread_data(); } diff --git a/cds/threading/details/pthread_manager.h b/cds/threading/details/pthread_manager.h index 16090f97..dce4aadb 100644 --- a/cds/threading/details/pthread_manager.h +++ b/cds/threading/details/pthread_manager.h @@ -90,7 +90,7 @@ namespace cds { namespace threading { static ThreadData * get() { - return reinterpret_cast( pthread_getspecific( m_key ) ); + return reinterpret_cast( pthread_getspecific( m_key )); } static void alloc() @@ -204,7 +204,7 @@ namespace cds { namespace threading { assert( pData ); if ( pData ) { - if ( pData->fini() ) + if ( pData->fini()) _threadData( do_detachThread ); } else diff --git a/cds/threading/details/wintls_manager.h b/cds/threading/details/wintls_manager.h index 2796ea76..04a0cabf 100644 --- a/cds/threading/details/wintls_manager.h +++ b/cds/threading/details/wintls_manager.h @@ -203,7 +203,7 @@ namespace cds { namespace threading { assert( pData ); if ( pData ) { - if ( pData->fini() ) + if ( pData->fini()) _threadData( do_detachThread ); } else diff --git a/cds/urcu/details/base.h b/cds/urcu/details/base.h index 57787993..23452681 100644 --- a/cds/urcu/details/base.h +++ b/cds/urcu/details/base.h @@ -362,7 +362,7 @@ namespace cds { // First, try to reuse a retired (non-active) HP record for ( pRec = m_pHead.load( atomics::memory_order_acquire ); pRec; pRec = pRec->m_list.m_pNext ) { cds::OS::ThreadId thId = nullThreadId; - if ( !pRec->m_list.m_idOwner.compare_exchange_strong( thId, curThreadId, atomics::memory_order_seq_cst, atomics::memory_order_relaxed ) ) + if ( !pRec->m_list.m_idOwner.compare_exchange_strong( thId, curThreadId, atomics::memory_order_seq_cst, atomics::memory_order_relaxed )) continue; return pRec; } @@ -417,7 +417,7 @@ namespace cds { assert( p->m_list.m_idOwner.load( atomics::memory_order_relaxed ) == nullThreadId || p->m_list.m_idOwner.load( atomics::memory_order_relaxed ) == mainThreadId - || !cds::OS::is_thread_alive( p->m_list.m_idOwner.load( atomics::memory_order_relaxed ) ) + || !cds::OS::is_thread_alive( p->m_list.m_idOwner.load( atomics::memory_order_relaxed )) ); al.Delete( p ); diff --git a/cds/urcu/details/check_deadlock.h b/cds/urcu/details/check_deadlock.h index 38216180..281e5f6a 100644 --- a/cds/urcu/details/check_deadlock.h +++ b/cds/urcu/details/check_deadlock.h @@ -41,8 +41,8 @@ namespace cds { namespace urcu { namespace details { { static void check() { - assert( !RCU::is_locked() ); - if ( RCU::is_locked() ) + assert( !RCU::is_locked()); + if ( RCU::is_locked()) throw cds::urcu::rcu_deadlock(); } }; @@ -59,7 +59,7 @@ namespace cds { namespace urcu { namespace details { { static void check() { - assert( !RCU::is_locked() ); + assert( !RCU::is_locked()); } }; diff --git a/cds/urcu/details/gp.h b/cds/urcu/details/gp.h index ad2fb01a..95ce5386 100644 --- a/cds/urcu/details/gp.h +++ b/cds/urcu/details/gp.h @@ -43,7 +43,7 @@ namespace cds { namespace urcu { namespace details { template inline gp_thread_gc::gp_thread_gc() { - if ( !threading::Manager::isThreadAttached() ) + if ( !threading::Manager::isThreadAttached()) cds::threading::Manager::attachThread(); } @@ -114,7 +114,7 @@ namespace cds { namespace urcu { namespace details { m_nGlobalControl.fetch_xor( general_purpose_rcu::c_nControlBit, atomics::memory_order_seq_cst ); for ( thread_record * pRec = m_ThreadList.head( atomics::memory_order_acquire ); pRec; pRec = pRec->m_list.m_pNext ) { - while ( pRec->m_list.m_idOwner.load( atomics::memory_order_acquire ) != nullThreadId && check_grace_period( pRec ) ) { + while ( pRec->m_list.m_idOwner.load( atomics::memory_order_acquire ) != nullThreadId && check_grace_period( pRec )) { bkoff(); CDS_COMPILER_RW_BARRIER; } diff --git a/cds/urcu/details/gp_decl.h b/cds/urcu/details/gp_decl.h index eb1f76d5..58c2bb8b 100644 --- a/cds/urcu/details/gp_decl.h +++ b/cds/urcu/details/gp_decl.h @@ -95,9 +95,9 @@ namespace cds { namespace urcu { namespace details { /// Retire pointer \p by the disposer \p pFunc template - static void retire( T * p, void (* pFunc)(T *) ) + static void retire( T * p, void (* pFunc)(T *)) { - retired_ptr rp( reinterpret_cast( p ), reinterpret_cast( pFunc ) ); + retired_ptr rp( reinterpret_cast( p ), reinterpret_cast( pFunc )); retire( rp ); } diff --git a/cds/urcu/details/gpb.h b/cds/urcu/details/gpb.h index 0128b94d..e3d74442 100644 --- a/cds/urcu/details/gpb.h +++ b/cds/urcu/details/gpb.h @@ -105,7 +105,7 @@ namespace cds { namespace urcu { /// Returns singleton instance static general_buffered * instance() { - return static_cast( base_class::instance() ); + return static_cast( base_class::instance()); } /// Checks if the singleton is created and ready to use static bool isUsed() @@ -140,7 +140,7 @@ namespace cds { namespace urcu { p.free(); } else { - push_buffer( std::move(p) ); + push_buffer( std::move(p)); break; } } @@ -150,7 +150,7 @@ namespace cds { namespace urcu { bool push_buffer( epoch_retired_ptr&& ep ) { bool bPushed = m_Buffer.push( ep ); - if ( !bPushed || m_Buffer.size() >= capacity() ) { + if ( !bPushed || m_Buffer.size() >= capacity()) { synchronize(); if ( !bPushed ) { ep.free(); @@ -175,7 +175,7 @@ namespace cds { namespace urcu { /// Destroys singleton object static void Destruct( bool bDetachAll = false ) { - if ( isUsed() ) { + if ( isUsed()) { instance()->clear_buffer( std::numeric_limits< uint64_t >::max()); if ( bDetachAll ) instance()->m_ThreadList.detach_all(); @@ -205,7 +205,7 @@ namespace cds { namespace urcu { while ( itFirst != itLast ) { epoch_retired_ptr ep( *itFirst, nEpoch ); ++itFirst; - push_buffer( std::move(ep) ); + push_buffer( std::move(ep)); } } @@ -235,7 +235,7 @@ namespace cds { namespace urcu { atomics::atomic_thread_fence( atomics::memory_order_acquire ); { std::unique_lock sl( m_Lock ); - if ( ep.m_p && m_Buffer.push( ep ) ) + if ( ep.m_p && m_Buffer.push( ep )) return false; nEpoch = m_nCurEpoch.fetch_add( 1, atomics::memory_order_relaxed ); flip_and_wait(); diff --git a/cds/urcu/details/gpi.h b/cds/urcu/details/gpi.h index 0a21fe70..71b310e5 100644 --- a/cds/urcu/details/gpi.h +++ b/cds/urcu/details/gpi.h @@ -123,7 +123,7 @@ namespace cds { namespace urcu { /// Destroys singleton object static void Destruct( bool bDetachAll = false ) { - if ( isUsed() ) { + if ( isUsed()) { if ( bDetachAll ) instance()->m_ThreadList.detach_all(); delete instance(); diff --git a/cds/urcu/details/gpt.h b/cds/urcu/details/gpt.h index 239fc1a2..fb0a1e4a 100644 --- a/cds/urcu/details/gpt.h +++ b/cds/urcu/details/gpt.h @@ -126,7 +126,7 @@ namespace cds { namespace urcu { /// Returns singleton instance static general_threaded * instance() { - return static_cast( base_class::instance() ); + return static_cast( base_class::instance()); } /// Checks if the singleton is created and ready to use static bool isUsed() @@ -152,7 +152,7 @@ namespace cds { namespace urcu { bool push_buffer( epoch_retired_ptr&& p ) { bool bPushed = m_Buffer.push( p ); - if ( !bPushed || m_Buffer.size() >= capacity() ) { + if ( !bPushed || m_Buffer.size() >= capacity()) { synchronize(); if ( !bPushed ) p.free(); @@ -176,7 +176,7 @@ namespace cds { namespace urcu { static void Construct( size_t nBufferCapacity = 256 ) { if ( !singleton_ptr::s_pRCU ) { - std::unique_ptr< general_threaded, scoped_disposer > pRCU( new general_threaded( nBufferCapacity ) ); + std::unique_ptr< general_threaded, scoped_disposer > pRCU( new general_threaded( nBufferCapacity )); pRCU->m_DisposerThread.start(); singleton_ptr::s_pRCU = pRCU.release(); @@ -186,7 +186,7 @@ namespace cds { namespace urcu { /// Destroys singleton object and terminates internal reclamation thread static void Destruct( bool bDetachAll = false ) { - if ( isUsed() ) { + if ( isUsed()) { general_threaded * pThis = instance(); if ( bDetachAll ) pThis->m_ThreadList.detach_all(); diff --git a/cds/urcu/details/sh.h b/cds/urcu/details/sh.h index ed2bdca6..c2300f35 100644 --- a/cds/urcu/details/sh.h +++ b/cds/urcu/details/sh.h @@ -46,7 +46,7 @@ namespace cds { namespace urcu { namespace details { template inline sh_thread_gc::sh_thread_gc() { - if ( !threading::Manager::isThreadAttached() ) + if ( !threading::Manager::isThreadAttached()) cds::threading::Manager::attachThread(); } diff --git a/cds/urcu/details/sh_decl.h b/cds/urcu/details/sh_decl.h index c559ef86..e5529622 100644 --- a/cds/urcu/details/sh_decl.h +++ b/cds/urcu/details/sh_decl.h @@ -98,9 +98,9 @@ namespace cds { namespace urcu { namespace details { /// Retire pointer \p by the disposer \p pFunc template - static void retire( T * p, void (* pFunc)(T *) ) + static void retire( T * p, void (* pFunc)(T *)) { - retired_ptr rp( reinterpret_cast( p ), reinterpret_cast( pFunc ) ); + retired_ptr rp( reinterpret_cast( p ), reinterpret_cast( pFunc )); retire( rp ); } diff --git a/cds/urcu/details/sig_buffered.h b/cds/urcu/details/sig_buffered.h index d78c6836..6ca3a749 100644 --- a/cds/urcu/details/sig_buffered.h +++ b/cds/urcu/details/sig_buffered.h @@ -107,7 +107,7 @@ namespace cds { namespace urcu { /// Returns singleton instance static signal_buffered * instance() { - return static_cast( base_class::instance() ); + return static_cast( base_class::instance()); } /// Checks if the singleton is created and ready to use static bool isUsed() @@ -126,7 +126,7 @@ namespace cds { namespace urcu { ~signal_buffered() { - clear_buffer( std::numeric_limits< uint64_t >::max() ); + clear_buffer( std::numeric_limits< uint64_t >::max()); } void clear_buffer( uint64_t nEpoch ) @@ -137,7 +137,7 @@ namespace cds { namespace urcu { p.free(); } else { - push_buffer( std::move(p) ); + push_buffer( std::move(p)); break; } } @@ -146,7 +146,7 @@ namespace cds { namespace urcu { bool push_buffer( epoch_retired_ptr&& ep ) { bool bPushed = m_Buffer.push( ep ); - if ( !bPushed || m_Buffer.size() >= capacity() ) { + if ( !bPushed || m_Buffer.size() >= capacity()) { synchronize(); if ( !bPushed ) { ep.free(); @@ -173,7 +173,7 @@ namespace cds { namespace urcu { /// Destroys singleton object static void Destruct( bool bDetachAll = false ) { - if ( isUsed() ) { + if ( isUsed()) { instance()->clear_buffer( std::numeric_limits< uint64_t >::max()); if ( bDetachAll ) instance()->m_ThreadList.detach_all(); diff --git a/cds/urcu/details/sig_threaded.h b/cds/urcu/details/sig_threaded.h index 0b3e6fa1..53684a99 100644 --- a/cds/urcu/details/sig_threaded.h +++ b/cds/urcu/details/sig_threaded.h @@ -116,7 +116,7 @@ namespace cds { namespace urcu { /// Returns singleton instance static signal_threaded * instance() { - return static_cast( base_class::instance() ); + return static_cast( base_class::instance()); } /// Checks if the singleton is created and ready to use static bool isUsed() @@ -137,7 +137,7 @@ namespace cds { namespace urcu { bool push_buffer( epoch_retired_ptr&& p ) { bool bPushed = m_Buffer.push( p ); - if ( !bPushed || m_Buffer.size() >= capacity() ) { + if ( !bPushed || m_Buffer.size() >= capacity()) { synchronize(); if ( !bPushed ) { p.free(); @@ -164,7 +164,7 @@ namespace cds { namespace urcu { static void Construct( size_t nBufferCapacity = 256, int nSignal = SIGUSR1 ) { if ( !singleton_ptr::s_pRCU ) { - std::unique_ptr< signal_threaded, scoped_disposer > pRCU( new signal_threaded( nBufferCapacity, nSignal ) ); + std::unique_ptr< signal_threaded, scoped_disposer > pRCU( new signal_threaded( nBufferCapacity, nSignal )); pRCU->m_DisposerThread.start(); singleton_ptr::s_pRCU = pRCU.release(); @@ -174,7 +174,7 @@ namespace cds { namespace urcu { /// Destroys singleton object and terminates internal reclamation thread static void Destruct( bool bDetachAll = false ) { - if ( isUsed() ) { + if ( isUsed()) { signal_threaded * pThis = instance(); if ( bDetachAll ) pThis->m_ThreadList.detach_all(); diff --git a/cds/urcu/dispose_thread.h b/cds/urcu/dispose_thread.h index 46336744..98d5fde5 100644 --- a/cds/urcu/dispose_thread.h +++ b/cds/urcu/dispose_thread.h @@ -136,7 +136,7 @@ namespace cds { namespace urcu { while ( ( p = pBuf->front()) != nullptr ) { if ( p->m_nEpoch <= nCurEpoch ) { p->free(); - CDS_VERIFY( pBuf->pop_front() ); + CDS_VERIFY( pBuf->pop_front()); } else break; diff --git a/cds/urcu/exempt_ptr.h b/cds/urcu/exempt_ptr.h index cdc8633b..0ffd2381 100644 --- a/cds/urcu/exempt_ptr.h +++ b/cds/urcu/exempt_ptr.h @@ -183,8 +183,8 @@ namespace cds { namespace urcu { /// Disposes the pointer. Should be called only outside of RCU critical section void release() { - if ( !empty() ) { - assert( !rcu::is_locked() ); + if ( !empty()) { + assert( !rcu::is_locked()); rcu::template retire_ptr( m_pNode ); m_pNode = nullptr; } diff --git a/cds/urcu/general_buffered.h b/cds/urcu/general_buffered.h index cd6af3ec..18bc01b2 100644 --- a/cds/urcu/general_buffered.h +++ b/cds/urcu/general_buffered.h @@ -97,9 +97,9 @@ namespace cds { namespace urcu { If the buffer is full, \ref synchronize function is invoked. */ template - static void retire_ptr( T * p, void (* pFunc)(T *) ) + static void retire_ptr( T * p, void (* pFunc)(T *)) { - retired_ptr rp( reinterpret_cast( p ), reinterpret_cast( pFunc ) ); + retired_ptr rp( reinterpret_cast( p ), reinterpret_cast( pFunc )); retire_ptr( rp ); } diff --git a/cds/urcu/general_instant.h b/cds/urcu/general_instant.h index b8f1d904..1051024e 100644 --- a/cds/urcu/general_instant.h +++ b/cds/urcu/general_instant.h @@ -90,9 +90,9 @@ namespace cds { namespace urcu { and then evaluates disposing expression pFunc( p ) */ template - static void retire_ptr( T * p, void (* pFunc)(T *) ) + static void retire_ptr( T * p, void (* pFunc)(T *)) { - retired_ptr rp( reinterpret_cast( p ), reinterpret_cast( pFunc ) ); + retired_ptr rp( reinterpret_cast( p ), reinterpret_cast( pFunc )); retire_ptr( rp ); } diff --git a/cds/urcu/general_threaded.h b/cds/urcu/general_threaded.h index d9585693..5a740c49 100644 --- a/cds/urcu/general_threaded.h +++ b/cds/urcu/general_threaded.h @@ -103,9 +103,9 @@ namespace cds { namespace urcu { If the buffer is full, \ref synchronize function is invoked. */ template - static void retire_ptr( T * p, void (* pFunc)(T *) ) + static void retire_ptr( T * p, void (* pFunc)(T *)) { - retired_ptr rp( reinterpret_cast( p ), reinterpret_cast( pFunc ) ); + retired_ptr rp( reinterpret_cast( p ), reinterpret_cast( pFunc )); retire_ptr( rp ); } diff --git a/cds/urcu/signal_buffered.h b/cds/urcu/signal_buffered.h index 4e9aa58b..f241ff9a 100644 --- a/cds/urcu/signal_buffered.h +++ b/cds/urcu/signal_buffered.h @@ -103,9 +103,9 @@ namespace cds { namespace urcu { If the buffer is full, \ref synchronize function is invoked. */ template - static void retire_ptr( T * p, void (* pFunc)(T *) ) + static void retire_ptr( T * p, void (* pFunc)(T *)) { - retired_ptr rp( reinterpret_cast( p ), reinterpret_cast( pFunc ) ); + retired_ptr rp( reinterpret_cast( p ), reinterpret_cast( pFunc )); retire_ptr( rp ); } diff --git a/cds/urcu/signal_threaded.h b/cds/urcu/signal_threaded.h index 80a5ed8c..0656e8bf 100644 --- a/cds/urcu/signal_threaded.h +++ b/cds/urcu/signal_threaded.h @@ -110,9 +110,9 @@ namespace cds { namespace urcu { If the buffer is full, \ref synchronize function is invoked. */ template - static void retire_ptr( T * p, void (* pFunc)(T *) ) + static void retire_ptr( T * p, void (* pFunc)(T *)) { - retired_ptr rp( reinterpret_cast( p ), reinterpret_cast( pFunc ) ); + retired_ptr rp( reinterpret_cast( p ), reinterpret_cast( pFunc )); retire_ptr( rp ); } diff --git a/src/dhp_gc.cpp b/src/dhp_gc.cpp index c49665a4..0d08a550 100644 --- a/src/dhp_gc.cpp +++ b/src/dhp_gc.cpp @@ -249,7 +249,7 @@ namespace cds { namespace gc { namespace dhp { details::retired_ptr_node * pBusyLast = &dummy; size_t nBusyCount = 0; - for ( details::guard_data * pGuard = m_GuardPool.begin(); pGuard; pGuard = pGuard->pGlobalNext.load(atomics::memory_order_acquire) ) + for ( details::guard_data * pGuard = m_GuardPool.begin(); pGuard; pGuard = pGuard->pGlobalNext.load(atomics::memory_order_acquire)) { // get guarded pointer details::guard_data::guarded_ptr valGuarded = pGuard->pPost.load(atomics::memory_order_acquire); diff --git a/src/dllmain.cpp b/src/dllmain.cpp index 84567671..3cc55b82 100644 --- a/src/dllmain.cpp +++ b/src/dllmain.cpp @@ -92,7 +92,7 @@ static void discover_topology() if (buffer) free(buffer); - buffer = reinterpret_cast( ::malloc( returnLength ) ); + buffer = reinterpret_cast( ::malloc( returnLength )); if ( buffer == nullptr ) { // allocation failed @@ -149,7 +149,7 @@ static void discover_topology() // Build relationship processor -> cell /* s_arrProcessorCellRelationship = new unsigned int[s_nProcessorCount]; - memset( s_arrProcessorCellRelationship, 0, s_nProcessorCount * sizeof(s_arrProcessorCellRelationship[0]) ); + memset( s_arrProcessorCellRelationship, 0, s_nProcessorCount * sizeof(s_arrProcessorCellRelationship[0])); byteOffset = 0; ptr = buffer; while (byteOffset + sizeof(SYSTEM_LOGICAL_PROCESSOR_INFORMATION) <= returnLength) @@ -159,7 +159,7 @@ static void discover_topology() case RelationNumaNode: // Non-NUMA systems report a single record of this type. for ( unsigned int i = 0; i < sizeof(ptr->ProcessorMask) * 8; ++i ) { - if ( ptr->ProcessorMask & (1 << i) ) { + if ( ptr->ProcessorMask & (1 << i)) { assert( i < s_nProcessorCount ); assert( ptr->NumaNode.NodeNumber < s_nProcessorGroupCount ); if ( i < s_nProcessorCount ) diff --git a/src/hp_gc.cpp b/src/hp_gc.cpp index 46f23f0d..eb667c2f 100644 --- a/src/hp_gc.cpp +++ b/src/hp_gc.cpp @@ -96,7 +96,7 @@ namespace cds { namespace gc { for ( hplist_node * hprec = pHead; hprec; hprec = pNext ) { assert( hprec->m_idOwner.load( atomics::memory_order_relaxed ) == nullThreadId || hprec->m_idOwner.load( atomics::memory_order_relaxed ) == mainThreadId - || !cds::OS::is_thread_alive( hprec->m_idOwner.load( atomics::memory_order_relaxed ) ) + || !cds::OS::is_thread_alive( hprec->m_idOwner.load( atomics::memory_order_relaxed )) ); details::retired_vector& vect = hprec->m_arrRetired; details::retired_vector::iterator itRetired = vect.begin(); @@ -136,7 +136,7 @@ namespace cds { namespace gc { // First try to reuse a retired (non-active) HP record for ( hprec = m_pListHead.load( atomics::memory_order_acquire ); hprec; hprec = hprec->m_pNextNode ) { cds::OS::ThreadId thId = nullThreadId; - if ( !hprec->m_idOwner.compare_exchange_strong( thId, curThreadId, atomics::memory_order_seq_cst, atomics::memory_order_relaxed ) ) + if ( !hprec->m_idOwner.compare_exchange_strong( thId, curThreadId, atomics::memory_order_seq_cst, atomics::memory_order_relaxed )) continue; hprec->m_bFree.store( false, atomics::memory_order_release ); return hprec; @@ -203,7 +203,7 @@ namespace cds { namespace gc { } // Sort plist to simplify search in - std::sort( plist.begin(), plist.end() ); + std::sort( plist.begin(), plist.end()); // Stage 2: Search plist details::retired_vector& arrRetired = pRec->m_arrRetired; @@ -219,7 +219,7 @@ namespace cds { namespace gc { std::vector< void * >::iterator itEnd = plist.end(); size_t nDeferredCount = 0; while ( itRetired != itRetiredEnd ) { - if ( std::binary_search( itBegin, itEnd, itRetired->m_p ) ) { + if ( std::binary_search( itBegin, itEnd, itRetired->m_p )) { arrRetired.push( *itRetired ); ++nDeferredCount; } @@ -274,7 +274,7 @@ namespace cds { namespace gc { { details::retired_ptr dummyRetired; while ( pNode ) { - if ( !pNode->m_bFree.load( atomics::memory_order_acquire ) ) { + if ( !pNode->m_bFree.load( atomics::memory_order_acquire )) { for ( size_t i = 0; i < m_nHazardPointerCount; ++i ) { pRec->sync(); void * hptr = pNode->m_hzp[i].get(); @@ -318,14 +318,14 @@ namespace cds { namespace gc { { CDS_HAZARDPTR_STATISTIC( ++m_Stat.m_HelpScanCallCount ) - assert( static_cast(pThis)->m_idOwner.load(atomics::memory_order_relaxed) == cds::OS::get_current_thread_id() ); + assert( static_cast(pThis)->m_idOwner.load(atomics::memory_order_relaxed) == cds::OS::get_current_thread_id()); const cds::OS::ThreadId nullThreadId = cds::OS::c_NullThreadId; const cds::OS::ThreadId curThreadId = cds::OS::get_current_thread_id(); for ( hplist_node * hprec = m_pListHead.load(atomics::memory_order_acquire); hprec; hprec = hprec->m_pNextNode ) { // If m_bFree == true then hprec->m_arrRetired is empty - we don't need to see it - if ( hprec->m_bFree.load(atomics::memory_order_acquire) ) + if ( hprec->m_bFree.load(atomics::memory_order_acquire)) continue; // Owns hprec if it is empty. @@ -396,7 +396,7 @@ namespace cds { namespace gc { ++stat.nHPRecAllocated; stat.nTotalRetiredPtrCount += hprec->m_arrRetired.size(); - if ( hprec->m_bFree.load(atomics::memory_order_relaxed) ) { + if ( hprec->m_bFree.load(atomics::memory_order_relaxed)) { // Free HP record stat.nRetiredPtrInFreeHPRecs += hprec->m_arrRetired.size(); } diff --git a/src/topology_linux.cpp b/src/topology_linux.cpp index 416ec6ca..6da24a33 100644 --- a/src/topology_linux.cpp +++ b/src/topology_linux.cpp @@ -50,7 +50,7 @@ namespace cds { namespace OS { CDS_CXX11_INLINE_NAMESPACE namespace Linux { std::string line; unsigned int nProcCount = 0; - while ( !cpuinfo.eof() ) { + while ( !cpuinfo.eof()) { std::getline(cpuinfo,line); if (!line.size()) continue; diff --git a/test/include/cds_test/fixture.h b/test/include/cds_test/fixture.h index ec56e327..0aefacc2 100644 --- a/test/include/cds_test/fixture.h +++ b/test/include/cds_test/fixture.h @@ -48,14 +48,14 @@ namespace cds_test { static void shuffle( RandomIt first, RandomIt last ) { static std::random_device random_dev; - static std::mt19937 random_gen( random_dev() ); + static std::mt19937 random_gen( random_dev()); std::shuffle( first, last, random_gen ); } static inline unsigned int rand( unsigned int nMax ) { - double rnd = double( std::rand() ) / double( RAND_MAX ); + double rnd = double( std::rand()) / double( RAND_MAX ); unsigned int n = (unsigned int)(rnd * nMax); return n < nMax ? n : (n - 1); } diff --git a/test/include/cds_test/hash_func.h b/test/include/cds_test/hash_func.h index 6f08e097..22d67d3d 100644 --- a/test/include/cds_test/hash_func.h +++ b/test/include/cds_test/hash_func.h @@ -5,7 +5,7 @@ Source code repo: http://github.com/khizmax/libcds/ Download: http://sourceforge.net/projects/libcds/files/ - + Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: @@ -25,7 +25,7 @@ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #ifndef CDSUNIT_HASH_FUNC_H @@ -52,7 +52,7 @@ namespace cds_test { hash_type operator()( std::string const& s ) const { - return CityHash32( s.c_str(), s.length() ); + return CityHash32( s.c_str(), s.length()); } template @@ -82,7 +82,7 @@ namespace cds_test { hash_type operator()( std::string const& s ) const { - return CityHash64( s.c_str(), s.length() ); + return CityHash64( s.c_str(), s.length()); } template @@ -112,7 +112,7 @@ namespace cds_test { hash_type operator()( std::string const& s ) const { - return CityHash128( s.c_str(), s.length() ); + return CityHash128( s.c_str(), s.length()); } template diff --git a/test/include/cds_test/stat_feldman_hashset_out.h b/test/include/cds_test/stat_feldman_hashset_out.h index 68c60e19..5fc11fb6 100644 --- a/test/include/cds_test/stat_feldman_hashset_out.h +++ b/test/include/cds_test/stat_feldman_hashset_out.h @@ -69,7 +69,7 @@ namespace cds_test { # define CDSSTRESS_LEVELSTAT_OUT( level, field ) \ CDSSTRESS_STAT_OUT_( "level_stat." + std::to_string(level) + "." + #field, it->field ) - o << CDSSTRESS_STAT_OUT_( "stat.level_count", level_stat.size() ); + o << CDSSTRESS_STAT_OUT_( "stat.level_count", level_stat.size()); size_t i = 0; for ( auto it = level_stat.begin(); it != level_stat.end(); ++it, ++i ) { o << CDSSTRESS_LEVELSTAT_OUT( i, array_node_count ) diff --git a/test/include/cds_test/stat_flat_combining_out.h b/test/include/cds_test/stat_flat_combining_out.h index df06d9f8..ef0404d2 100644 --- a/test/include/cds_test/stat_flat_combining_out.h +++ b/test/include/cds_test/stat_flat_combining_out.h @@ -43,7 +43,7 @@ namespace cds_test { static inline property_stream& operator <<( property_stream& o, cds::algo::flat_combining::stat<> const& s ) { return o - << CDSSTRESS_STAT_OUT_( "combining_factor", s.combining_factor() ) + << CDSSTRESS_STAT_OUT_( "combining_factor", s.combining_factor()) << CDSSTRESS_STAT_OUT( s, m_nOperationCount ) << CDSSTRESS_STAT_OUT( s, m_nCombiningCount ) << CDSSTRESS_STAT_OUT( s, m_nCompactPublicationList ) diff --git a/test/include/cds_test/stat_sync_monitor_out.h b/test/include/cds_test/stat_sync_monitor_out.h index 71320b89..b108b9e5 100644 --- a/test/include/cds_test/stat_sync_monitor_out.h +++ b/test/include/cds_test/stat_sync_monitor_out.h @@ -52,7 +52,7 @@ namespace cds_test { return o; } -# define CDSSTRESS_POOLMONITOR_STAT_OUT( s, field ) CDSSTRESS_STAT_OUT_( "pool_monitor." #field, s.field.get() ) +# define CDSSTRESS_POOLMONITOR_STAT_OUT( s, field ) CDSSTRESS_STAT_OUT_( "pool_monitor." #field, s.field.get()) static inline property_stream& operator <<( property_stream& o, cds::sync::pool_monitor_traits::stat<> const& s ) { diff --git a/test/include/cds_test/stress_test.h b/test/include/cds_test/stress_test.h index dca60f3b..e9486641 100644 --- a/test/include/cds_test/stress_test.h +++ b/test/include/cds_test/stress_test.h @@ -45,7 +45,7 @@ namespace cds_test { { std::string strParamName( pszParamName ); auto it = m_Cfg.find( strParamName ); - if ( it == m_Cfg.end() ) + if ( it == m_Cfg.end()) return std::string( pszDefVal ); // param not found -> returns default value return it->second; } @@ -54,7 +54,7 @@ namespace cds_test { { std::string strParamName( pszParamName ); cfg_map::const_iterator it = m_Cfg.find( strParamName ); - if ( it == m_Cfg.end() ) + if ( it == m_Cfg.end()) return defVal; // param not found -> returns default value return atoi( it->second.c_str()); } @@ -63,7 +63,7 @@ namespace cds_test { { std::string strParamName( pszParamName ); cfg_map::const_iterator it = m_Cfg.find( strParamName ); - if ( it == m_Cfg.end() ) + if ( it == m_Cfg.end()) return defVal; // param not found -> returns default value return static_cast( strtoul( it->second.c_str(), NULL, 10 )); } @@ -72,7 +72,7 @@ namespace cds_test { { std::string strParamName( pszParamName ); cfg_map::const_iterator it = m_Cfg.find( strParamName ); - if ( it == m_Cfg.end() ) + if ( it == m_Cfg.end()) return defVal; // param not found -> returns default value return strtol( it->second.c_str(), NULL, 10 ); } @@ -81,7 +81,7 @@ namespace cds_test { { std::string strParamName( pszParamName ); cfg_map::const_iterator it = m_Cfg.find( strParamName ); - if ( it == m_Cfg.end() ) + if ( it == m_Cfg.end()) return defVal; // param not found -> returns default value return strtoul( it->second.c_str(), NULL, 10 ); } @@ -90,7 +90,7 @@ namespace cds_test { { std::string strParamName( pszParamName ); cfg_map::const_iterator it = m_Cfg.find( strParamName ); - if ( it == m_Cfg.end() ) + if ( it == m_Cfg.end()) return defVal; // param not found -> returns default value return static_cast( strtoul( it->second.c_str(), NULL, 10 )); } @@ -99,7 +99,7 @@ namespace cds_test { { std::string strParamName( pszParamName ); cfg_map::const_iterator it = m_Cfg.find( strParamName ); - if ( it == m_Cfg.end() ) + if ( it == m_Cfg.end()) return defVal; // param not found -> returns default value return !( it->second.empty() || it->second == "0" @@ -131,7 +131,7 @@ namespace cds_test { { std::stringstream ss; ss << prop.second; - ::testing::Test::RecordProperty( prop.first.c_str(), ss.str().c_str() ); + ::testing::Test::RecordProperty( prop.first.c_str(), ss.str().c_str()); return s; } @@ -139,7 +139,7 @@ namespace cds_test { { std::stringstream ss; ss << prop.second.count(); - ::testing::Test::RecordProperty( prop.first, ss.str().c_str() ); + ::testing::Test::RecordProperty( prop.first, ss.str().c_str()); return s; } diff --git a/test/include/cds_test/thread.h b/test/include/cds_test/thread.h index 080e3360..0048294b 100644 --- a/test/include/cds_test/thread.h +++ b/test/include/cds_test/thread.h @@ -126,7 +126,7 @@ namespace cds_test { std::chrono::milliseconds run() { - return run( std::chrono::seconds::zero() ); + return run( std::chrono::seconds::zero()); } std::chrono::milliseconds run( std::chrono::seconds duration ) @@ -134,7 +134,7 @@ namespace cds_test { m_bStopped = false; m_doneCount = 0; - while ( m_readyCount.load() != m_threads.size() ) + while ( m_readyCount.load() != m_threads.size()) std::this_thread::yield(); m_bTimeElapsed.store( false, std::memory_order_release ); @@ -149,7 +149,7 @@ namespace cds_test { m_cvStart.notify_all(); } - if ( duration != std::chrono::seconds::zero() ) { + if ( duration != std::chrono::seconds::zero()) { for ( ;; ) { std::this_thread::sleep_for( native_duration ); auto time_now = std::chrono::steady_clock::now(); @@ -162,7 +162,7 @@ namespace cds_test { { scoped_lock l( m_cvMutex ); - while ( m_doneCount != m_threads.size() ) + while ( m_doneCount != m_threads.size()) m_cvDone.wait( l ); m_bStopped = true; } @@ -263,7 +263,7 @@ namespace cds_test { inline thread::thread( thread const& sample ) : m_pool( sample.m_pool ) , m_type( sample.m_type ) - , m_id( m_pool.get_next_id() ) + , m_id( m_pool.get_next_id()) , m_impl( &thread::run, this ) {} diff --git a/test/stress/framework/config.cpp b/test/stress/framework/config.cpp index f414c0da..e1933890 100644 --- a/test/stress/framework/config.cpp +++ b/test/stress/framework/config.cpp @@ -46,7 +46,7 @@ namespace cds_test { config const& operator[]( const std::string& testName ) const { auto it = m_cfg.find( testName ); - if ( it != m_cfg.end() ) + if ( it != m_cfg.end()) return it->second; return m_emptyCfg; } @@ -56,7 +56,7 @@ namespace cds_test { { std::ifstream s; s.open( fileName ); - if ( !s.is_open() ) { + if ( !s.is_open()) { std::cerr << "WARNING: Cannot open test cfg file " << fileName << "\n\tUse default settings" << std::endl; @@ -68,17 +68,17 @@ namespace cds_test { char buf[4096]; config * pMap = nullptr; - while ( !s.eof() ) { - s.getline( buf, sizeof( buf ) / sizeof( buf[0] ) ); + while ( !s.eof()) { + s.getline( buf, sizeof( buf ) / sizeof( buf[0] )); char * pszStr = buf; // trim left - while ( *pszStr != 0 && (*pszStr == ' ' || *pszStr == '\t') ) ++pszStr; + while ( *pszStr != 0 && (*pszStr == ' ' || *pszStr == '\t')) ++pszStr; // trim right char * pszEnd = strchr( pszStr, 0 ); if ( pszEnd == pszStr ) // empty srtring continue; --pszEnd; - while ( pszEnd != pszStr && (*pszEnd == ' ' || *pszEnd == '\t' || *pszEnd == '\n' || *pszEnd == '\r') ) --pszEnd; + while ( pszEnd != pszStr && (*pszEnd == ' ' || *pszEnd == '\t' || *pszEnd == '\n' || *pszEnd == '\r')) --pszEnd; if ( pszStr == pszEnd ) // empty string continue; @@ -104,7 +104,7 @@ namespace cds_test { continue; pszEnd = pszEq; - while ( pszStr <= --pszEnd && (*pszEnd == ' ' || *pszEnd == '\t' || *pszEnd == '\n' || *pszEnd == '\r') ); + while ( pszStr <= --pszEnd && (*pszEnd == ' ' || *pszEnd == '\t' || *pszEnd == '\n' || *pszEnd == '\r')); if ( pszEnd <= pszStr ) continue; diff --git a/test/stress/framework/stress_test.cpp b/test/stress/framework/stress_test.cpp index caff4bb8..b4a7e5ff 100644 --- a/test/stress/framework/stress_test.cpp +++ b/test/stress/framework/stress_test.cpp @@ -50,7 +50,7 @@ namespace cds_test { std::ifstream s; char const* filename = "./dictionary.txt"; s.open( filename ); - if ( !s.is_open() ) { + if ( !s.is_open()) { std::cerr << "WARNING: Cannot open test file " << filename << std::endl; return arrString; } @@ -60,9 +60,9 @@ namespace cds_test { arrString.reserve( std::stoul( line )); - while ( !s.eof() ) { + while ( !s.eof()) { std::getline( s, line ); - if ( !line.empty() ) + if ( !line.empty()) arrString.push_back( std::move( line )); } diff --git a/test/stress/freelist/put_get.cpp b/test/stress/freelist/put_get.cpp index da1922c5..6a51563e 100644 --- a/test/stress/freelist/put_get.cpp +++ b/test/stress/freelist/put_get.cpp @@ -175,7 +175,7 @@ namespace { }; atomics::atomic tp; - if ( tp.is_lock_free() ) { + if ( tp.is_lock_free()) { cds::intrusive::TaggedFreeList fl; test( fl ); } diff --git a/test/stress/freelist/put_get_single.cpp b/test/stress/freelist/put_get_single.cpp index 4850e8f0..7ffd2446 100644 --- a/test/stress/freelist/put_get_single.cpp +++ b/test/stress/freelist/put_get_single.cpp @@ -155,7 +155,7 @@ namespace { }; atomics::atomic tp; - if ( tp.is_lock_free() ) { + if ( tp.is_lock_free()) { cds::intrusive::TaggedFreeList fl; test( fl ); } diff --git a/test/stress/map/delodd/map_delodd.cpp b/test/stress/map/delodd/map_delodd.cpp index ecf45bde..7419144f 100644 --- a/test/stress/map/delodd/map_delodd.cpp +++ b/test/stress/map/delodd/map_delodd.cpp @@ -94,8 +94,8 @@ namespace map { m_arrInsert[i] = i; m_arrRemove[i] = i; } - shuffle( m_arrInsert.begin(), m_arrInsert.end() ); - shuffle( m_arrRemove.begin(), m_arrRemove.end() ); + shuffle( m_arrInsert.begin(), m_arrInsert.end()); + shuffle( m_arrRemove.begin(), m_arrRemove.end()); } void Map_DelOdd::TearDownTestCase() @@ -119,5 +119,5 @@ namespace map { return lf; } - INSTANTIATE_TEST_CASE_P( a, Map_DelOdd_LF, ::testing::ValuesIn( Map_DelOdd_LF::get_load_factors() ) ); + INSTANTIATE_TEST_CASE_P( a, Map_DelOdd_LF, ::testing::ValuesIn( Map_DelOdd_LF::get_load_factors()) ); } // namespace map diff --git a/test/stress/map/delodd/map_delodd.h b/test/stress/map/delodd/map_delodd.h index bdb5f59a..62306896 100644 --- a/test/stress/map/delodd/map_delodd.h +++ b/test/stress/map/delodd/map_delodd.h @@ -197,7 +197,7 @@ namespace map { std::vector& arrData = fixture.m_arrInsert; for ( size_t i = 0; i < arrData.size(); ++i ) { - if ( rMap.insert( key_type( arrData[i], id() ))) + if ( rMap.insert( key_type( arrData[i], id()))) ++m_nInsertSuccess; else ++m_nInsertFailed; @@ -206,7 +206,7 @@ namespace map { ensure_func f; for ( size_t i = arrData.size() - 1; i > 0; --i ) { if ( arrData[i] & 1 ) { - rMap.update( key_type( arrData[i], id() ), f ); + rMap.update( key_type( arrData[i], id()), f ); } } @@ -562,7 +562,7 @@ namespace map { cds_test::thread_pool& pool = get_pool(); pool.add( new insert_thread( pool, testMap ), s_nInsThreadCount ); - pool.add( new delete_thread( pool, testMap ), s_nDelThreadCount ? s_nDelThreadCount : cds::OS::topology::processor_count() ); + pool.add( new delete_thread( pool, testMap ), s_nDelThreadCount ? s_nDelThreadCount : cds::OS::topology::processor_count()); propout() << std::make_pair( "insert_thread_count", s_nInsThreadCount ) << std::make_pair( "delete_thread_count", s_nDelThreadCount ) @@ -637,7 +637,7 @@ namespace map { size_t nExtractFailed = 0; for ( size_t i = 0; i < pool.size(); ++i ) { cds_test::thread& thr = pool.get( i ); - switch ( thr.type() ) { + switch ( thr.type()) { case inserter_thread: { insert_thread& inserter = static_cast(thr); @@ -685,7 +685,7 @@ namespace map { { for ( size_t n = 0; n < s_nMapSize; n +=2 ) { for ( size_t i = 0; i < s_nInsThreadCount; ++i ) { - EXPECT_TRUE( testMap.contains( key_type( n, i ) ) ) << "key=" << n << "/" << i; + EXPECT_TRUE( testMap.contains( key_type( n, i )) ) << "key=" << n << "/" << i; } } } @@ -694,7 +694,7 @@ namespace map { check_before_cleanup( testMap ); testMap.clear(); - EXPECT_TRUE( testMap.empty() ) << "map.size=" << testMap.size(); + EXPECT_TRUE( testMap.empty()) << "map.size=" << testMap.size(); additional_check( testMap ); additional_cleanup( testMap ); diff --git a/test/stress/map/find_int/map_find_int.cpp b/test/stress/map/find_int/map_find_int.cpp index e021106e..88bff4f6 100644 --- a/test/stress/map/find_int/map_find_int.cpp +++ b/test/stress/map/find_int/map_find_int.cpp @@ -68,7 +68,7 @@ namespace map { if ( s_Data[i].bExists ) ++s_nRealMapSize; } - shuffle( s_Data.begin(), s_Data.end() ); + shuffle( s_Data.begin(), s_Data.end()); } void Map_find_int::SetUpTestCase() @@ -128,5 +128,5 @@ namespace map { return lf; } - INSTANTIATE_TEST_CASE_P( a, Map_find_int_LF, ::testing::ValuesIn( Map_find_int_LF::get_load_factors() ) ); + INSTANTIATE_TEST_CASE_P( a, Map_find_int_LF, ::testing::ValuesIn( Map_find_int_LF::get_load_factors()) ); } // namespace map diff --git a/test/stress/map/find_string/map_find_string.cpp b/test/stress/map/find_string/map_find_string.cpp index abacd907..51cee8d1 100644 --- a/test/stress/map/find_string/map_find_string.cpp +++ b/test/stress/map/find_string/map_find_string.cpp @@ -140,7 +140,7 @@ namespace map { hasher h; for ( size_t i = 0; i < s_arrString.size(); ++i ) { hash_type hash = h( s_arrString.at( i )); - if ( mapHash.insert( std::make_pair( hash, i ) ).second ) { + if ( mapHash.insert( std::make_pair( hash, i )).second ) { if ( ++nDiffHash >= nSize ) break; bool bExists = rand( 100 ) <= s_nPercentExists; @@ -195,5 +195,5 @@ namespace map { return lf; } - INSTANTIATE_TEST_CASE_P( a, Map_find_string_LF, ::testing::ValuesIn( Map_find_string::get_load_factors() ) ); + INSTANTIATE_TEST_CASE_P( a, Map_find_string_LF, ::testing::ValuesIn( Map_find_string::get_load_factors()) ); } // namespace map diff --git a/test/stress/map/find_string/map_find_string.h b/test/stress/map/find_string/map_find_string.h index 0b2e050b..cfa04626 100644 --- a/test/stress/map/find_string/map_find_string.h +++ b/test/stress/map/find_string/map_find_string.h @@ -121,7 +121,7 @@ namespace map { if ( id() & 1 ) { auto itEnd = s_Data.cend(); for ( auto it = s_Data.cbegin(); it != itEnd; ++it ) { - auto bFound = rMap.contains( *(it->pKey) ); + auto bFound = rMap.contains( *(it->pKey)); if ( it->bExists ) { if ( check_result(bFound, rMap)) ++m_KeyExists.nSuccess; @@ -139,7 +139,7 @@ namespace map { else { auto itEnd = s_Data.crend(); for ( auto it = s_Data.crbegin(); it != itEnd; ++it ) { - auto bFound = rMap.contains( *(it->pKey) ); + auto bFound = rMap.contains( *(it->pKey)); if ( it->bExists ) { if ( check_result(bFound, rMap)) ++m_KeyExists.nSuccess; diff --git a/test/stress/map/insdel_func/map_insdel_func.cpp b/test/stress/map/insdel_func/map_insdel_func.cpp index 9887078a..6227d342 100644 --- a/test/stress/map/insdel_func/map_insdel_func.cpp +++ b/test/stress/map/insdel_func/map_insdel_func.cpp @@ -99,7 +99,7 @@ namespace map { s_arrKeys.reserve( s_nMapSize ); for ( size_t i = 0; i < s_nMapSize; ++i ) s_arrKeys.push_back( i ); - shuffle( s_arrKeys.begin(), s_arrKeys.end() ); + shuffle( s_arrKeys.begin(), s_arrKeys.end()); } void Map_InsDel_func::TearDownTestCase() diff --git a/test/stress/map/insdel_func/map_insdel_func.h b/test/stress/map/insdel_func/map_insdel_func.h index 8b177a1f..66e3a949 100644 --- a/test/stress/map/insdel_func/map_insdel_func.h +++ b/test/stress/map/insdel_func/map_insdel_func.h @@ -460,7 +460,7 @@ namespace map { for ( size_t i = 0; i < pool.size(); ++i ) { cds_test::thread& thr = pool.get( i ); - switch ( thr.type() ) { + switch ( thr.type()) { case insert_thread: { inserter& t = static_cast( thr ); @@ -502,7 +502,7 @@ namespace map { << std::make_pair( "update_failed", nUpdateFailed ) << std::make_pair( "update_functor_create", nEnsFuncCreated ) << std::make_pair( "update_functor_modify", nEnsFuncModified ) - << std::make_pair( "finish_map_size", testMap.size() ); + << std::make_pair( "finish_map_size", testMap.size()); EXPECT_EQ( nDelValueFailed, 0u ); EXPECT_EQ( nDelValueSuccess, nDeleteSuccess ); diff --git a/test/stress/map/insdel_int/map_insdel_int.cpp b/test/stress/map/insdel_int/map_insdel_int.cpp index 19725a0a..020a70a0 100644 --- a/test/stress/map/insdel_int/map_insdel_int.cpp +++ b/test/stress/map/insdel_int/map_insdel_int.cpp @@ -94,7 +94,7 @@ namespace map { s_arrKeys.reserve( s_nMapSize ); for ( size_t i = 0; i < s_nMapSize; ++i ) s_arrKeys.push_back( i ); - shuffle( s_arrKeys.begin(), s_arrKeys.end() ); + shuffle( s_arrKeys.begin(), s_arrKeys.end()); } void Map_InsDel_int::TearDownTestCase() diff --git a/test/stress/map/insdel_int/map_insdel_int.h b/test/stress/map/insdel_int/map_insdel_int.h index 4a85d90d..fc1d88f1 100644 --- a/test/stress/map/insdel_int/map_insdel_int.h +++ b/test/stress/map/insdel_int/map_insdel_int.h @@ -98,7 +98,7 @@ namespace map { if ( id() & 1 ) { for ( size_t nPass = 0; nPass < s_nThreadPassCount; ++nPass ) { for ( key_array::const_iterator it = s_arrKeys.cbegin(), itEnd = s_arrKeys.cend(); it != itEnd; ++it ) { - if ( rMap.insert( *it, *it * 8 ) ) + if ( rMap.insert( *it, *it * 8 )) ++m_nInsertSuccess; else ++m_nInsertFailed; @@ -108,7 +108,7 @@ namespace map { else { for ( size_t nPass = 0; nPass < s_nThreadPassCount; ++nPass ) { for ( key_array::const_reverse_iterator it = s_arrKeys.crbegin(), itEnd = s_arrKeys.crend(); it != itEnd; ++it ) { - if ( rMap.insert( *it, *it * 8 ) ) + if ( rMap.insert( *it, *it * 8 )) ++m_nInsertSuccess; else ++m_nInsertFailed; @@ -150,7 +150,7 @@ namespace map { if ( id() & 1 ) { for ( size_t nPass = 0; nPass < s_nThreadPassCount; ++nPass ) { for ( key_array::const_iterator it = s_arrKeys.cbegin(), itEnd = s_arrKeys.cend(); it != itEnd; ++it ) { - if ( rMap.erase( *it ) ) + if ( rMap.erase( *it )) ++m_nDeleteSuccess; else ++m_nDeleteFailed; @@ -160,7 +160,7 @@ namespace map { else { for ( size_t nPass = 0; nPass < s_nThreadPassCount; ++nPass ) { for ( key_array::const_reverse_iterator it = s_arrKeys.crbegin(), itEnd = s_arrKeys.crend(); it != itEnd; ++it ) { - if ( rMap.erase( *it ) ) + if ( rMap.erase( *it )) ++m_nDeleteSuccess; else ++m_nDeleteFailed; @@ -197,7 +197,7 @@ namespace map { for ( size_t i = 0; i < pool.size(); ++i ) { cds_test::thread& thr = pool.get( i ); - switch ( thr.type() ) { + switch ( thr.type()) { case insert_thread: { inserter& t = static_cast( thr ); @@ -222,7 +222,7 @@ namespace map { << std::make_pair( "insert_failed", nInsertFailed ) << std::make_pair( "delete_success", nDeleteSuccess ) << std::make_pair( "delete_failed", nDeleteFailed ) - << std::make_pair( "finish_map_size", testMap.size() ); + << std::make_pair( "finish_map_size", testMap.size()); check_before_cleanup( testMap ); diff --git a/test/stress/map/insdel_item_int/map_insdel_item_int.h b/test/stress/map/insdel_item_int/map_insdel_item_int.h index 339caa56..5e750002 100644 --- a/test/stress/map/insdel_item_int/map_insdel_item_int.h +++ b/test/stress/map/insdel_item_int/map_insdel_item_int.h @@ -206,7 +206,7 @@ namespace map { v.reserve( s_nMapSize ); for ( size_t i = 0; i < s_nMapSize; ++i ) v.push_back( i ); - shuffle( v.begin(), v.end() ); + shuffle( v.begin(), v.end()); for ( auto i: v ) EXPECT_TRUE( testMap.insert( i, i )); } @@ -233,7 +233,7 @@ namespace map { for ( size_t i = 0; i < pool.size(); ++i ) { cds_test::thread& thr = pool.get( i ); - switch ( thr.type() ) { + switch ( thr.type()) { case insert_thread: { inserter& t = static_cast(thr); @@ -267,7 +267,7 @@ namespace map { // Check if the map contains all items for ( size_t i = 0; i < s_nMapSize; ++i ) - EXPECT_TRUE( testMap.contains( i ) ) << "key=" << i; + EXPECT_TRUE( testMap.contains( i )) << "key=" << i; check_before_cleanup( testMap ); diff --git a/test/stress/map/insdel_string/map_insdel_string.cpp b/test/stress/map/insdel_string/map_insdel_string.cpp index c051e222..1dd25d55 100644 --- a/test/stress/map/insdel_string/map_insdel_string.cpp +++ b/test/stress/map/insdel_string/map_insdel_string.cpp @@ -100,7 +100,7 @@ namespace map { s_arrKeys.reserve( s_nMapSize ); std::vector dict = load_dictionary(); for ( size_t i = 0; i < s_nMapSize; ++i ) - s_arrKeys.push_back( std::move( dict.at(i) )); + s_arrKeys.push_back( std::move( dict.at(i))); } void Map_InsDel_string::TearDownTestCase() @@ -141,11 +141,11 @@ namespace map { size_t nDiffHash = 0; hasher h; for ( size_t i = 0; i < dict.size(); ++i ) { - hash_type hash = h( dict.at( i ) ); - if ( mapHash.insert( std::make_pair( hash, i ) ).second ) { + hash_type hash = h( dict.at( i )); + if ( mapHash.insert( std::make_pair( hash, i )).second ) { if ( ++nDiffHash >= nSize ) break; - s_arrKeys.push_back( std::move( dict.at( i ) )); + s_arrKeys.push_back( std::move( dict.at( i ))); } } s_nMapSize = dict.size(); diff --git a/test/stress/map/insdel_string/map_insdel_string.h b/test/stress/map/insdel_string/map_insdel_string.h index 41cd6a77..ec6dc671 100644 --- a/test/stress/map/insdel_string/map_insdel_string.h +++ b/test/stress/map/insdel_string/map_insdel_string.h @@ -205,7 +205,7 @@ namespace map { for ( size_t i = 0; i < pool.size(); ++i ) { cds_test::thread& thr = pool.get( i ); - switch ( thr.type() ) { + switch ( thr.type()) { case insert_thread: { inserter& t = static_cast(thr); @@ -230,14 +230,14 @@ namespace map { << std::make_pair( "insert_failed", nInsertFailed ) << std::make_pair( "delete_success", nDeleteSuccess ) << std::make_pair( "delete_failed", nDeleteFailed ) - << std::make_pair( "finish_map_size", testMap.size() ); + << std::make_pair( "finish_map_size", testMap.size()); check_before_cleanup( testMap ); //testMap.clear(); for ( auto const& str: s_arrKeys ) testMap.erase( str ); - EXPECT_TRUE( testMap.empty() ); + EXPECT_TRUE( testMap.empty()); EXPECT_EQ( testMap.size(), 0u ); additional_check( testMap ); diff --git a/test/stress/map/insdelfind/map_insdelfind.h b/test/stress/map/insdelfind/map_insdelfind.h index df52df45..3c16a9a5 100644 --- a/test/stress/map/insdelfind/map_insdelfind.h +++ b/test/stress/map/insdelfind/map_insdelfind.h @@ -127,7 +127,7 @@ namespace map { size_t const nNormalize = size_t(-1) / ( s_nMapSize * 2 ); size_t nRand = 0; - while ( !time_elapsed() ) { + while ( !time_elapsed()) { nRand = cds::bitop::RandXorShift( nRand ); size_t n = nRand / nNormalize; switch ( s_arrShuffle[i] ) { @@ -177,7 +177,7 @@ namespace map { arr.reserve( s_nMapSize ); for ( size_t i = 0; i < s_nMapSize; ++i ) arr.push_back( i * 2 + 1); - shuffle( arr.begin(), arr.end() ); + shuffle( arr.begin(), arr.end()); for ( size_t i = 0; i < s_nMapSize; ++i ) testMap.insert( arr[i], arr[i] ); } @@ -218,7 +218,7 @@ namespace map { << std::make_pair( "delete_failed", nDeleteFailed ) << std::make_pair( "find_success", nFindSuccess ) << std::make_pair( "find_failed", nFindFailed ) - << std::make_pair( "finish_map_size", testMap.size() ); + << std::make_pair( "finish_map_size", testMap.size()); { ASSERT_TRUE( std::chrono::duration_cast(duration).count() > 0 ); diff --git a/test/stress/map/insfind_int/map_insfind_int.h b/test/stress/map/insfind_int/map_insfind_int.h index 7b97aed6..9c8daa98 100644 --- a/test/stress/map/insfind_int/map_insfind_int.h +++ b/test/stress/map/insfind_int/map_insfind_int.h @@ -82,7 +82,7 @@ namespace map { size_t nItem = id(); for ( size_t i = 0; i < nSize; nItem += nThreadCount, ++i ) m_arrVal[i] = nItem; - shuffle( m_arrVal.begin(), m_arrVal.end() ); + shuffle( m_arrVal.begin(), m_arrVal.end()); } public: size_t m_nInsertSuccess = 0; @@ -171,7 +171,7 @@ namespace map { << std::make_pair( "insert_failed", nInsertFailed ) << std::make_pair( "find_success", nFindSuccess ) << std::make_pair( "find_failed", nFindFailed ) - << std::make_pair( "finish_map_size", testMap.size() ); + << std::make_pair( "finish_map_size", testMap.size()); EXPECT_EQ( nInsertFailed, 0u ); EXPECT_EQ( nFindFailed, 0u ); diff --git a/test/stress/map/map_type.h b/test/stress/map/map_type.h index 08373a66..44f51fb0 100644 --- a/test/stress/map/map_type.h +++ b/test/stress/map/map_type.h @@ -64,7 +64,7 @@ namespace map { struct cmp { int operator ()(Key const& k1, Key const& k2) const { - if ( less( k1, k2 ) ) + if ( less( k1, k2 )) return -1; return less( k2, k1 ) ? 1 : 0; } diff --git a/test/stress/map/map_type_cuckoo.h b/test/stress/map/map_type_cuckoo.h index bc78537f..85b50205 100644 --- a/test/stress/map/map_type_cuckoo.h +++ b/test/stress/map/map_type_cuckoo.h @@ -57,7 +57,7 @@ namespace map { template bool erase_with( Q const& key, Pred /*pred*/ ) { - return base_class::erase_with( key, typename std::conditional< base_class::c_isSorted, Pred, typename Pred::equal_to>::type() ); + return base_class::erase_with( key, typename std::conditional< base_class::c_isSorted, Pred, typename Pred::equal_to>::type()); } // for testing @@ -295,7 +295,7 @@ namespace map { static inline void print_stat( cds_test::property_stream& o, CuckooMap< Key, V, Traits > const& s ) { typedef CuckooMap< Key, V, Traits > map_type; - print_stat( o, static_cast(s) ); + print_stat( o, static_cast(s)); } } // namespace map diff --git a/test/stress/map/map_type_ellen_bintree.h b/test/stress/map/map_type_ellen_bintree.h index f9265e3b..27ba5419 100644 --- a/test/stress/map/map_type_ellen_bintree.h +++ b/test/stress/map/map_type_ellen_bintree.h @@ -259,13 +259,13 @@ namespace map { static inline void additional_check( EllenBinTreeMap& m ) { GC::force_dispose(); - ellen_bintree_check::check_stat( m.statistics() ); + ellen_bintree_check::check_stat( m.statistics()); } template static inline void check_before_cleanup( EllenBinTreeMap& m ) { - EXPECT_TRUE( m.check_consistency() ); + EXPECT_TRUE( m.check_consistency()); } } // namespace map diff --git a/test/stress/map/map_type_std.h b/test/stress/map/map_type_std.h index 3a729820..0f3c0059 100644 --- a/test/stress/map/map_type_std.h +++ b/test/stress/map/map_type_std.h @@ -73,14 +73,14 @@ namespace map { bool insert( const Key& key, const Value& val ) { scoped_lock al( m_lock ); - return base_class::insert( typename base_class::value_type( key, val ) ).second; + return base_class::insert( typename base_class::value_type( key, val )).second; } template bool insert( const Key& key, const T& val, Func func ) { scoped_lock al( m_lock ); - std::pair pRet = base_class::insert( typename base_class::value_type( key, Value() ) ); + std::pair pRet = base_class::insert( typename base_class::value_type( key, Value()) ); if ( pRet.second ) { func( pRet.first->second, val ); return true; @@ -92,7 +92,7 @@ namespace map { std::pair update( const T& key, Func func, bool /*bAllowInsert*/ = true ) { scoped_lock al( m_lock ); - std::pair pRet = base_class::insert( typename base_class::value_type( key, Value() ) ); + std::pair pRet = base_class::insert( typename base_class::value_type( key, Value()) ); if ( pRet.second ) { func( true, *pRet.first ); return std::make_pair( true, true ); @@ -114,8 +114,8 @@ namespace map { { scoped_lock al( m_lock ); typename base_class::iterator it = base_class::find( key ); - if ( it != base_class::end() ) { - func( (*it) ); + if ( it != base_class::end()) { + func( (*it)); base_class::erase( it ); return true; } @@ -180,7 +180,7 @@ namespace map { bool insert( const Key& key, const T& val, Func func ) { scoped_lock al( m_lock ); - std::pair pRet = base_class::insert( typename base_class::value_type(key, Value() )); + std::pair pRet = base_class::insert( typename base_class::value_type(key, Value())); if ( pRet.second ) { func( pRet.first->second, val ); return true; @@ -192,7 +192,7 @@ namespace map { std::pair update( const T& key, Func func, bool /*bAllowInsert*/ = true ) { scoped_lock al( m_lock ); - std::pair pRet = base_class::insert( typename base_class::value_type( key, Value() )); + std::pair pRet = base_class::insert( typename base_class::value_type( key, Value())); if ( pRet.second ) { func( true, *pRet.first ); return std::make_pair( true, true ); @@ -214,7 +214,7 @@ namespace map { { scoped_lock al( m_lock ); typename base_class::iterator it = base_class::find( key ); - if ( it != base_class::end() ) { + if ( it != base_class::end()) { func( *it ); return base_class::erase( key ) != 0; } diff --git a/test/stress/map/map_type_striped.h b/test/stress/map/map_type_striped.h index 6d0d01f4..5ab14511 100644 --- a/test/stress/map/map_type_striped.h +++ b/test/stress/map/map_type_striped.h @@ -80,7 +80,7 @@ namespace map { public: template StripedHashMap_seq( Config const& cfg ) - : base_class( cfg.s_nMapSize / cfg.s_nLoadFactor / 16, *(new(&m_placeHolder) resizing_policy_t( cfg.s_nLoadFactor )) ) + : base_class( cfg.s_nMapSize / cfg.s_nLoadFactor / 16, *(new(&m_placeHolder) resizing_policy_t( cfg.s_nLoadFactor ))) {} empty_stat statistics() const @@ -113,7 +113,7 @@ namespace map { public: template StripedHashMap_ord( Config const& cfg ) - : base_class( 0, *(new(&m_placeHolder) resizing_policy_t( cfg.s_nMaxLoadFactor * 1024 )) ) + : base_class( 0, *(new(&m_placeHolder) resizing_policy_t( cfg.s_nMaxLoadFactor * 1024 ))) {} empty_stat statistics() const @@ -229,7 +229,7 @@ namespace map { public: template RefinableHashMap_ord( Config const& cfg ) - : base_class( 0, *(new(&m_placeHolder) resizing_policy_t( cfg.s_nMaxLoadFactor * 1024 )) ) + : base_class( 0, *(new(&m_placeHolder) resizing_policy_t( cfg.s_nMaxLoadFactor * 1024 ))) {} empty_stat statistics() const diff --git a/test/stress/pqueue/pop.cpp b/test/stress/pqueue/pop.cpp index 89b0241f..dc979121 100644 --- a/test/stress/pqueue/pop.cpp +++ b/test/stress/pqueue/pop.cpp @@ -124,12 +124,12 @@ namespace { arr.reserve( s_nQueueSize ); for ( size_t i = 0; i < s_nQueueSize; ++i ) arr.push_back( i ); - shuffle( arr.begin(), arr.end() ); + shuffle( arr.begin(), arr.end()); size_t nPushError = 0; typedef typename PQueue::value_type value_type; for ( auto it = arr.begin(); it != arr.end(); ++it ) { - if ( !q.push( value_type( *it ) )) + if ( !q.push( value_type( *it ))) ++nPushError; } s_nQueueSize -= nPushError; @@ -158,11 +158,11 @@ namespace { nTotalErrorEq += cons.m_nPopErrorEq; nTotalFailed += cons.m_nPopFailed; - if ( !cons.m_arrFailedPops.empty() ) { + if ( !cons.m_arrFailedPops.empty()) { std::cerr << "Priority violations, thread " << i; for ( size_t k = 0; k < cons.m_arrFailedPops.size(); ++k ) { std::cerr << "\n " << "prev_key=" << cons.m_arrFailedPops[k].prev_key << " popped_key=" << cons.m_arrFailedPops[k].popped_key; - if ( cons.m_arrFailedPops[k].next_key != static_cast(-1) ) + if ( cons.m_arrFailedPops[k].next_key != static_cast(-1)) std::cerr << " next_key=" << cons.m_arrFailedPops[k].next_key; else std::cerr << " next_key unspecified"; @@ -218,7 +218,7 @@ namespace { { \ typedef pqueue::Types::pqueue_t pqueue_type; \ std::unique_ptr< pqueue_type > pq( new pqueue_type ); \ - test( *pq.get() ); \ + test( *pq.get()); \ } //CDSSTRESS_MSPriorityQueue( pqueue_pop, MSPriorityQueue_static_less ) //CDSSTRESS_MSPriorityQueue( pqueue_pop, MSPriorityQueue_static_less_stat ) diff --git a/test/stress/pqueue/pqueue_type.h b/test/stress/pqueue/pqueue_type.h index 455d3571..60b86f70 100644 --- a/test/stress/pqueue/pqueue_type.h +++ b/test/stress/pqueue/pqueue_type.h @@ -92,7 +92,7 @@ namespace pqueue { bool pop( value_type& dest ) { scoped_lock l( m_Lock ); - if ( !m_PQueue.empty() ) { + if ( !m_PQueue.empty()) { dest = m_PQueue.top(); m_PQueue.pop(); return true; @@ -104,8 +104,8 @@ namespace pqueue { bool pop_with( Q& dest, MoveFunc f ) { scoped_lock l( m_Lock ); - if ( !m_PQueue.empty() ) { - f( dest, m_PQueue.top() ); + if ( !m_PQueue.empty()) { + f( dest, m_PQueue.top()); m_PQueue.pop(); return true; } @@ -115,7 +115,7 @@ namespace pqueue { void clear() { scoped_lock l( m_Lock ); - while ( !m_PQueue.empty() ) + while ( !m_PQueue.empty()) m_PQueue.pop(); } @@ -123,8 +123,8 @@ namespace pqueue { void clear_with( Func f ) { scoped_lock l( m_Lock ); - while ( !m_PQueue.empty() ) { - f( m_PQueue.top() ); + while ( !m_PQueue.empty()) { + f( m_PQueue.top()); m_PQueue.pop(); } } @@ -152,7 +152,7 @@ namespace pqueue { template bool operator()( T& dest, Tree& container ) const { - typename Tree::guarded_ptr gp( container.extract_max() ); + typename Tree::guarded_ptr gp( container.extract_max()); if ( gp ) dest = *gp; return !gp.empty(); @@ -165,7 +165,7 @@ namespace pqueue { template bool operator()( T& dest, Tree& container ) const { - typename Tree::exempt_ptr ep( container.extract_max() ); + typename Tree::exempt_ptr ep( container.extract_max()); if ( ep ) dest = *ep; return !ep.empty(); @@ -178,7 +178,7 @@ namespace pqueue { template bool operator()( T& dest, Tree& container ) const { - typename Tree::guarded_ptr gp( container.extract_min() ); + typename Tree::guarded_ptr gp( container.extract_min()); if ( gp ) dest = *gp; return !gp.empty(); @@ -191,7 +191,7 @@ namespace pqueue { template bool operator()( T& dest, Tree& container ) const { - typename Tree::exempt_ptr ep( container.extract_min() ); + typename Tree::exempt_ptr ep( container.extract_min()); if ( ep ) dest = *ep; return !ep.empty(); @@ -248,7 +248,7 @@ namespace pqueue { template bool operator()( T& dest, Set& container ) const { - typename Set::guarded_ptr gp( container.extract_max() ); + typename Set::guarded_ptr gp( container.extract_max()); if ( gp ) dest = *gp; return !gp.empty(); @@ -261,7 +261,7 @@ namespace pqueue { template bool operator()( T& dest, Set& container ) const { - typename Set::exempt_ptr ep( container.extract_max() ); + typename Set::exempt_ptr ep( container.extract_max()); if ( ep ) dest = *ep; return !ep.empty(); @@ -274,7 +274,7 @@ namespace pqueue { template bool operator()( T& dest, Set& container ) const { - typename Set::guarded_ptr gp( container.extract_min() ); + typename Set::guarded_ptr gp( container.extract_min()); if ( gp ) dest = *gp; return !gp.empty(); @@ -287,7 +287,7 @@ namespace pqueue { template bool operator()( T& dest, Set& container ) const { - typename Set::exempt_ptr ep( container.extract_min() ); + typename Set::exempt_ptr ep( container.extract_min()); if ( ep ) dest = *ep; return !ep.empty(); diff --git a/test/stress/pqueue/push.cpp b/test/stress/pqueue/push.cpp index eb5b0813..f945d7a4 100644 --- a/test/stress/pqueue/push.cpp +++ b/test/stress/pqueue/push.cpp @@ -67,7 +67,7 @@ namespace pqueue { typedef typename PQueue::value_type value_type; for ( auto it = m_arr.begin(); it != m_arr.end(); ++it ) { - if ( !m_Queue.push( value_type( *it ) )) + if ( !m_Queue.push( value_type( *it ))) ++m_nPushError; } } @@ -77,7 +77,7 @@ namespace pqueue { m_arr.reserve( nEnd - nStart ); for ( size_t i = nStart; i < nEnd; ++i ) m_arr.push_back( i ); - shuffle( m_arr.begin(), m_arr.end() ); + shuffle( m_arr.begin(), m_arr.end()); } public: @@ -179,7 +179,7 @@ namespace pqueue { { \ typedef pqueue::Types::pqueue_t pqueue_type; \ std::unique_ptr< pqueue_type > pq( new pqueue_type ); \ - test( *pq.get() ); \ + test( *pq.get()); \ } //CDSSTRESS_MSPriorityQueue( pqueue_push, MSPriorityQueue_static_less ) //CDSSTRESS_MSPriorityQueue( pqueue_push, MSPriorityQueue_static_less_stat ) diff --git a/test/stress/pqueue/push_pop.cpp b/test/stress/pqueue/push_pop.cpp index f1df9d64..adfca3c4 100644 --- a/test/stress/pqueue/push_pop.cpp +++ b/test/stress/pqueue/push_pop.cpp @@ -86,7 +86,7 @@ namespace { m_arr.reserve( nEnd - nStart ); for ( size_t i = nStart; i < nEnd; ++i ) m_arr.push_back( i ); - shuffle( m_arr.begin(), m_arr.end() ); + shuffle( m_arr.begin(), m_arr.end()); } public: @@ -121,7 +121,7 @@ namespace { virtual void test() { typename PQueue::value_type val; - while ( s_nProducerCount.load( atomics::memory_order_relaxed ) != 0 || !m_Queue.empty() ) { + while ( s_nProducerCount.load( atomics::memory_order_relaxed ) != 0 || !m_Queue.empty()) { if ( m_Queue.pop( val )) ++m_nPopSuccess; else @@ -192,7 +192,7 @@ namespace { EXPECT_EQ( nTotalPopped, s_nQueueSize ); EXPECT_EQ( nPushFailed, 0u ); - //check_statistics( testQueue.statistics() ); + //check_statistics( testQueue.statistics()); propout() << q.statistics(); } @@ -233,7 +233,7 @@ namespace { { \ typedef pqueue::Types::pqueue_t pqueue_type; \ std::unique_ptr< pqueue_type > pq( new pqueue_type ); \ - test( *pq.get() ); \ + test( *pq.get()); \ } //CDSSTRESS_MSPriorityQueue( pqueue_push_pop, MSPriorityQueue_static_less ) //CDSSTRESS_MSPriorityQueue( pqueue_push_pop, MSPriorityQueue_static_less_stat ) diff --git a/test/stress/queue/intrusive_push_pop.cpp b/test/stress/queue/intrusive_push_pop.cpp index 1429d996..a3a7c5b8 100644 --- a/test/stress/queue/intrusive_push_pop.cpp +++ b/test/stress/queue/intrusive_push_pop.cpp @@ -175,7 +175,7 @@ namespace { } else { ++m_nPopEmpty; - if ( s_nProducerCount.load( atomics::memory_order_acquire ) == 0 && m_Queue.empty() ) + if ( s_nProducerCount.load( atomics::memory_order_acquire ) == 0 && m_Queue.empty()) break; } } @@ -225,7 +225,7 @@ namespace { typedef typename Reader::const_data_iterator ReaderIterator; size_t nPostTestPops = 0; - while ( testQueue.pop() ) + while ( testQueue.pop()) ++nPostTestPops; size_t nTotalPops = 0; @@ -272,7 +272,7 @@ namespace { size_t nQueueSize = s_nThreadPushCount * s_nWriterThreadCount; EXPECT_EQ( nTotalPops + nPostTestPops, nQueueSize ); - EXPECT_TRUE( testQueue.empty() ); + EXPECT_TRUE( testQueue.empty()); // Test that all items have been popped // Test FIFO order @@ -294,7 +294,7 @@ namespace { for ( it = arrReaders[nReader]->m_WriterData[nWriter].begin(); it != itEnd; ++it ) arrData.push_back( *it ); } - std::sort( arrData.begin(), arrData.end() ); + std::sort( arrData.begin(), arrData.end()); for ( size_t i=1; i < arrData.size(); ++i ) { if ( arrData[i-1] + 1 != arrData[i] ) { EXPECT_EQ( arrData[i-1] + 1, arrData[i] ) << "Writer " << nWriter << ": [" << (i-1) << "]=" << arrData[i-1] @@ -514,6 +514,6 @@ namespace { INSTANTIATE_TEST_CASE_P( SQ, intrusive_segmented_queue_push_pop, - ::testing::ValuesIn( intrusive_segmented_queue_push_pop::get_test_parameters() ) ); + ::testing::ValuesIn( intrusive_segmented_queue_push_pop::get_test_parameters()) ); } // namespace diff --git a/test/stress/queue/intrusive_queue_type.h b/test/stress/queue/intrusive_queue_type.h index c4740563..4a88e80a 100644 --- a/test/stress/queue/intrusive_queue_type.h +++ b/test/stress/queue/intrusive_queue_type.h @@ -82,7 +82,7 @@ namespace queue { value_type * pop() { lock_guard l( m_Lock ); - if ( m_List.empty() ) + if ( m_List.empty()) return nullptr; value_type& v = m_List.front(); m_List.pop_front(); diff --git a/test/stress/queue/pop.cpp b/test/stress/queue/pop.cpp index 4bcf68c6..2747d125 100644 --- a/test/stress/queue/pop.cpp +++ b/test/stress/queue/pop.cpp @@ -91,7 +91,7 @@ namespace { typedef typename Queue::value_type value_type; value_type value; size_t nPopCount = 0; - while ( m_Queue.pop( value ) ) { + while ( m_Queue.pop( value )) { ++m_arr[ value.nNo ]; ++nPopCount; } diff --git a/test/stress/queue/push.cpp b/test/stress/queue/push.cpp index ed4963f8..0be51017 100644 --- a/test/stress/queue/push.cpp +++ b/test/stress/queue/push.cpp @@ -150,7 +150,7 @@ namespace { Producer& thread = static_cast&>(pool.get( i )); EXPECT_EQ( thread.m_nPushError, 0u ) << " producer thread " << i; } - EXPECT_TRUE( !q.empty() ); + EXPECT_TRUE( !q.empty()); std::unique_ptr< uint8_t[] > arr( new uint8_t[s_nQueueSize] ); memset( arr.get(), 0, sizeof(arr[0]) * s_nQueueSize ); diff --git a/test/stress/queue/push_pop.cpp b/test/stress/queue/push_pop.cpp index 0d2b37bf..927712d0 100644 --- a/test/stress/queue/push_pop.cpp +++ b/test/stress/queue/push_pop.cpp @@ -167,7 +167,7 @@ namespace { const size_t nTotalWriters = s_nProducerThreadCount; value_type v; while ( true ) { - if ( m_Queue.pop( v ) ) { + if ( m_Queue.pop( v )) { ++m_nPopped; if ( v.nWriterNo < nTotalWriters ) m_WriterData[ v.nWriterNo ].push_back( v.nNo ); @@ -178,7 +178,7 @@ namespace { ++m_nPopEmpty; if ( s_nProducerDone.load() >= nTotalWriters ) { - if ( m_Queue.empty() ) + if ( m_Queue.empty()) break; } } @@ -238,7 +238,7 @@ namespace { EXPECT_EQ( nTotalPops, nPoppedItems ); EXPECT_EQ( nTotalPops + nPostTestPops, s_nQueueSize ) << "nTotalPops=" << nTotalPops << ", nPostTestPops=" << nPostTestPops; - EXPECT_TRUE( q.empty() ); + EXPECT_TRUE( q.empty()); // Test consistency of popped sequence for ( size_t nWriter = 0; nWriter < s_nProducerThreadCount; ++nWriter ) { @@ -259,7 +259,7 @@ namespace { arrData.push_back( *it ); } - std::sort( arrData.begin(), arrData.end() ); + std::sort( arrData.begin(), arrData.end()); for ( size_t i=1; i < arrData.size(); ++i ) { EXPECT_EQ( arrData[i - 1] + 1, arrData[i] ) << "producer=" << nWriter; } diff --git a/test/stress/queue/random.cpp b/test/stress/queue/random.cpp index 1094d82e..2e7cbe1b 100644 --- a/test/stress/queue/random.cpp +++ b/test/stress/queue/random.cpp @@ -180,7 +180,7 @@ namespace { template void analyze( Queue& q ) { - EXPECT_TRUE( q.empty() ); + EXPECT_TRUE( q.empty()); std::vector< size_t > arrPushCount; arrPushCount.resize( s_nThreadCount, 0 ); diff --git a/test/stress/queue/std_queue.h b/test/stress/queue/std_queue.h index c488b1f4..34492341 100644 --- a/test/stress/queue/std_queue.h +++ b/test/stress/queue/std_queue.h @@ -56,7 +56,7 @@ namespace queue { bool dequeue( T& data ) { std::unique_lock a(m_Locker); - if ( base_class::empty() ) + if ( base_class::empty()) return false; data = base_class::front(); diff --git a/test/stress/set/delodd/set_delodd.cpp b/test/stress/set/delodd/set_delodd.cpp index bbef04ba..b2d43292 100644 --- a/test/stress/set/delodd/set_delodd.cpp +++ b/test/stress/set/delodd/set_delodd.cpp @@ -89,7 +89,7 @@ namespace set { m_arrData.resize( s_nSetSize ); for ( size_t i = 0; i < s_nSetSize; ++i ) m_arrData[i] = i; - shuffle( m_arrData.begin(), m_arrData.end() ); + shuffle( m_arrData.begin(), m_arrData.end()); } void Set_DelOdd::TearDownTestCase() @@ -112,5 +112,5 @@ namespace set { return lf; } - INSTANTIATE_TEST_CASE_P( a, Set_DelOdd_LF, ::testing::ValuesIn( Set_DelOdd_LF::get_load_factors() ) ); + INSTANTIATE_TEST_CASE_P( a, Set_DelOdd_LF, ::testing::ValuesIn( Set_DelOdd_LF::get_load_factors()) ); } // namespace set diff --git a/test/stress/set/delodd/set_delodd.h b/test/stress/set/delodd/set_delodd.h index cfa99f63..4c98268e 100644 --- a/test/stress/set/delodd/set_delodd.h +++ b/test/stress/set/delodd/set_delodd.h @@ -193,7 +193,7 @@ namespace set { std::vector& arrData = fixture.m_arrData; for ( size_t i = 0; i < arrData.size(); ++i ) { - if ( rSet.insert( key_type( arrData[i], id() ))) + if ( rSet.insert( key_type( arrData[i], id()))) ++m_nInsertSuccess; else ++m_nInsertFailed; @@ -202,7 +202,7 @@ namespace set { update_functor f; for ( size_t i = arrData.size() - 1; i > 0; --i ) { if ( arrData[i] & 1 ) - rSet.update( key_type( arrData[i], id() ), f, true ); + rSet.update( key_type( arrData[i], id()), f, true ); } fixture.m_nInsThreadCount.fetch_sub( 1, atomics::memory_order_release ); @@ -311,7 +311,7 @@ namespace set { struct eraser { static bool erase( SetType& s, size_t key, size_t /*thread*/) { - return s.erase_with( key, key_less() ); + return s.erase_with( key, key_less()); } }; @@ -641,7 +641,7 @@ namespace set { size_t nExtractFailed = 0; for ( size_t i = 0; i < pool.size(); ++i ) { cds_test::thread& thr = pool.get( i ); - switch ( thr.type() ) { + switch ( thr.type()) { case inserter_thread: { insert_thread& inserter = static_cast( thr ); @@ -695,7 +695,7 @@ namespace set { check_before_clear( testSet ); testSet.clear(); - EXPECT_TRUE( testSet.empty() ) << "set.size=" << testSet.size(); + EXPECT_TRUE( testSet.empty()) << "set.size=" << testSet.size(); additional_check( testSet ); print_stat( propout(), testSet ); diff --git a/test/stress/set/insdel_find/set_insdelfind.h b/test/stress/set/insdel_find/set_insdelfind.h index 7ac63b18..5989ba49 100644 --- a/test/stress/set/insdel_find/set_insdelfind.h +++ b/test/stress/set/insdel_find/set_insdelfind.h @@ -108,7 +108,7 @@ namespace set { size_t const nNormalize = size_t(-1) / ( fixture.s_nSetSize * 2); size_t nRand = 0; - while ( !time_elapsed() ) { + while ( !time_elapsed()) { nRand = cds::bitop::RandXorShift(nRand); size_t n = nRand / nNormalize; switch ( pAct[i] ) { @@ -152,7 +152,7 @@ namespace set { pInitArr[i] = i * 2 + 1; shuffle( pInitArr, pEnd ); for ( size_t * p = pInitArr; p < pEnd; ++p ) - testSet.insert( typename Set::value_type( *p, *p ) ); + testSet.insert( typename Set::value_type( *p, *p )); delete [] pInitArr; } @@ -196,7 +196,7 @@ namespace set { { ASSERT_TRUE( std::chrono::duration_cast(duration).count() > 0 ); size_t nTotalOps = nInsertSuccess + nInsertFailed + nDeleteSuccess + nDeleteFailed + nFindSuccess + nFindFailed; - propout() << std::make_pair( "avg_speed", nTotalOps / std::chrono::duration_cast(duration).count() ); + propout() << std::make_pair( "avg_speed", nTotalOps / std::chrono::duration_cast(duration).count()); } diff --git a/test/stress/set/insdel_func/set_insdel_func.h b/test/stress/set/insdel_func/set_insdel_func.h index 2d7232c0..20e88f13 100644 --- a/test/stress/set/insdel_func/set_insdel_func.h +++ b/test/stress/set/insdel_func/set_insdel_func.h @@ -72,7 +72,7 @@ namespace set { , nData(0) , nUpdateCall(0) , bInitialized( false ) - , threadId( cds::OS::get_current_thread_id() ) + , threadId( cds::OS::get_current_thread_id()) {} value( value const& s ) @@ -80,7 +80,7 @@ namespace set { , nData(s.nData) , nUpdateCall(s.nUpdateCall.load(atomics::memory_order_relaxed)) , bInitialized( s.bInitialized ) - , threadId( cds::OS::get_current_thread_id() ) + , threadId( cds::OS::get_current_thread_id()) , m_access() {} @@ -455,7 +455,7 @@ namespace set { for ( size_t i = 0; i < pool.size(); ++i ) { cds_test::thread& thr = pool.get( i ); - switch ( thr.type() ) { + switch ( thr.type()) { case insert_thread: { InserterThread& inserter = static_cast( thr ); @@ -494,7 +494,7 @@ namespace set { << std::make_pair( "update_created", nUpdateCreated ) << std::make_pair( "update_modified", nUpdateModified ) << std::make_pair( "update_failed", nUpdateFailed ) - << std::make_pair( "final_set_size", testSet.size() ); + << std::make_pair( "final_set_size", testSet.size()); EXPECT_EQ( nDelValueFailed, 0u ); @@ -511,7 +511,7 @@ namespace set { for ( size_t * p = m_pKeyFirst; p != m_pKeyLast; ++p ) testSet.erase( *p ); - EXPECT_TRUE( testSet.empty() ); + EXPECT_TRUE( testSet.empty()); EXPECT_EQ( testSet.size(), 0u ); additional_check( testSet ); diff --git a/test/stress/set/insdel_string/set_insdel_string.h b/test/stress/set/insdel_string/set_insdel_string.h index 6f1e8494..6e03537d 100644 --- a/test/stress/set/insdel_string/set_insdel_string.h +++ b/test/stress/set/insdel_string/set_insdel_string.h @@ -358,7 +358,7 @@ namespace set { size_t nDeleteFailed = 0; for ( size_t i = 0; i < pool.size(); ++i ) { cds_test::thread& thr = pool.get( i ); - switch ( thr.type() ) { + switch ( thr.type()) { case insert_thread: { InserterThread& inserter = static_cast( thr ); @@ -383,12 +383,12 @@ namespace set { << std::make_pair( "delete_success", nDeleteSuccess ) << std::make_pair( "insert_failed", nInsertFailed ) << std::make_pair( "delete_failed", nDeleteFailed ) - << std::make_pair( "final_set_size", testSet.size() ); + << std::make_pair( "final_set_size", testSet.size()); //testSet.clear(); for (auto const& str: m_arrString ) testSet.erase( str ); - EXPECT_TRUE( testSet.empty() ); + EXPECT_TRUE( testSet.empty()); EXPECT_EQ( testSet.size(), 0u ); additional_check( testSet ); @@ -429,7 +429,7 @@ namespace set { size_t nExtractFailed = 0; for ( size_t i = 0; i < pool.size(); ++i ) { cds_test::thread& thr = pool.get( i ); - switch ( thr.type() ) { + switch ( thr.type()) { case insert_thread: { InserterThread& inserter = static_cast(thr); @@ -463,12 +463,12 @@ namespace set { << std::make_pair( "insert_failed", nInsertFailed ) << std::make_pair( "delete_failed", nDeleteFailed ) << std::make_pair( "extract_failed", nExtractFailed ) - << std::make_pair( "final_set_size", testSet.size() ); + << std::make_pair( "final_set_size", testSet.size()); //testSet.clear(); for ( auto const& str : m_arrString ) testSet.erase( str ); - EXPECT_TRUE( testSet.empty() ); + EXPECT_TRUE( testSet.empty()); EXPECT_EQ( testSet.size(), 0u ); additional_check( testSet ); diff --git a/test/stress/set/iteration/set_iteration.h b/test/stress/set/iteration/set_iteration.h index d1385fe7..127e47a2 100644 --- a/test/stress/set/iteration/set_iteration.h +++ b/test/stress/set/iteration/set_iteration.h @@ -403,7 +403,7 @@ namespace set { Set& rSet = m_Set; Set_Iteration& fixture = pool().template fixture(); - while ( !fixture.all_modifiers_done() ) { + while ( !fixture.all_modifiers_done()) { ++m_nPassCount; typename Set::iterator it; typename Set::iterator itEnd; @@ -453,12 +453,12 @@ namespace set { Set& rSet = m_Set; Set_Iteration& fixture = pool().template fixture(); - while ( !fixture.all_modifiers_done() ) { + while ( !fixture.all_modifiers_done()) { ++m_nPassCount; typename Set::rcu_lock l; for ( auto it = rSet.begin(); it != rSet.end(); ++it ) { #if CDS_BUILD_BITS == 64 - it->val.hash = CityHash64( it->key.c_str(), it->key.length() ); + it->val.hash = CityHash64( it->key.c_str(), it->key.length()); #else it->val.hash = std::hash()(it->key); #endif @@ -500,7 +500,7 @@ namespace set { size_t nIteratorVisitCount = 0; for ( size_t i = 0; i < pool.size(); ++i ) { cds_test::thread& thr = pool.get( i ); - switch ( thr.type() ) { + switch ( thr.type()) { case insert_thread: { InserterThread& inserter = static_cast( thr ); @@ -534,10 +534,10 @@ namespace set { << std::make_pair( "delete_failed", nDeleteFailed ) << std::make_pair( "iterator_pass_count", nIteratorPassCount ) << std::make_pair( "iterator_visit_count", nIteratorVisitCount ) - << std::make_pair( "final_set_size", testSet.size() ); + << std::make_pair( "final_set_size", testSet.size()); testSet.clear(); - EXPECT_TRUE( testSet.empty() ); + EXPECT_TRUE( testSet.empty()); additional_check( testSet ); print_stat( propout(), testSet ); @@ -583,7 +583,7 @@ namespace set { size_t nIteratorVisitCount = 0; for ( size_t i = 0; i < pool.size(); ++i ) { cds_test::thread& thr = pool.get( i ); - switch ( thr.type() ) { + switch ( thr.type()) { case insert_thread: { InserterThread& inserter = static_cast(thr); @@ -626,10 +626,10 @@ namespace set { << std::make_pair( "extract_failed", nExtractFailed ) << std::make_pair( "iterator_pass_count", nIteratorPassCount ) << std::make_pair( "iterator_visit_count", nIteratorVisitCount ) - << std::make_pair( "final_set_size", testSet.size() ); + << std::make_pair( "final_set_size", testSet.size()); testSet.clear(); - EXPECT_TRUE( testSet.empty() ); + EXPECT_TRUE( testSet.empty()); additional_check( testSet ); print_stat( propout(), testSet ); diff --git a/test/stress/set/set_type.h b/test/stress/set/set_type.h index 1023c7b8..0fa5182b 100644 --- a/test/stress/set/set_type.h +++ b/test/stress/set/set_type.h @@ -63,7 +63,7 @@ namespace set { { int operator ()(Key const& k1, Key const& k2) const { - if ( less( k1, k2 ) ) + if ( less( k1, k2 )) return -1; return less( k2, k1 ) ? 1 : 0; } diff --git a/test/stress/set/set_type_cuckoo.h b/test/stress/set/set_type_cuckoo.h index 614582b1..dd76322d 100644 --- a/test/stress/set/set_type_cuckoo.h +++ b/test/stress/set/set_type_cuckoo.h @@ -57,7 +57,7 @@ namespace set { template bool erase_with( Q const& key, Pred /*pred*/ ) { - return cuckoo_base_class::erase_with( key, typename std::conditional< cuckoo_base_class::c_isSorted, Pred, typename Pred::equal_to>::type() ); + return cuckoo_base_class::erase_with( key, typename std::conditional< cuckoo_base_class::c_isSorted, Pred, typename Pred::equal_to>::type()); } // for testing @@ -202,7 +202,7 @@ namespace set { static inline void print_stat( cds_test::property_stream& o, CuckooSet< V, Traits > const& s ) { typedef CuckooSet< V, Traits > set_type; - print_stat( o, static_cast(s) ); + print_stat( o, static_cast(s)); } } // namespace set diff --git a/test/stress/set/set_type_ellen_bintree.h b/test/stress/set/set_type_ellen_bintree.h index 9ae452c5..a04ce503 100644 --- a/test/stress/set/set_type_ellen_bintree.h +++ b/test/stress/set/set_type_ellen_bintree.h @@ -286,10 +286,10 @@ namespace set { { EXPECT_EQ( stat.m_nInternalNodeCreated, stat.m_nInternalNodeDeleted ); EXPECT_EQ( stat.m_nUpdateDescCreated, stat.m_nUpdateDescDeleted ); - //EXPECT_EQ( ellen_bintree_pool::internal_node_counter::m_nAlloc.get(), ellen_bintree_pool::internal_node_counter::m_nFree.get() ); + //EXPECT_EQ( ellen_bintree_pool::internal_node_counter::m_nAlloc.get(), ellen_bintree_pool::internal_node_counter::m_nFree.get()); EXPECT_EQ( ellen_bintree_pool::internal_node_counter::m_nAlloc.get(), stat.m_nInternalNodeCreated ); // true if RCU is not threaded - //EXPECT_EQ( stat.m_nInternalNodeDeleted, ellen_bintree_pool::internal_node_counter::m_nFree.get() ); + //EXPECT_EQ( stat.m_nInternalNodeDeleted, ellen_bintree_pool::internal_node_counter::m_nFree.get()); } } // namespace ellen_bintree_check @@ -320,7 +320,7 @@ namespace set { template static inline void check_before_clear( cds::container::EllenBinTreeSet& s ) { - EXPECT_TRUE( s.check_consistency() ); + EXPECT_TRUE( s.check_consistency()); } } // namespace set diff --git a/test/stress/set/set_type_feldman_hashset.h b/test/stress/set/set_type_feldman_hashset.h index 8e20b1ba..44c3ddf4 100644 --- a/test/stress/set/set_type_feldman_hashset.h +++ b/test/stress/set/set_type_feldman_hashset.h @@ -83,13 +83,13 @@ namespace set { template extracted_ptr extract(Q const& key) { - return base_class::extract( hasher()(key) ); + return base_class::extract( hasher()(key)); } template bool contains( Q const& key ) { - return base_class::contains( hasher()(key) ); + return base_class::contains( hasher()(key)); } // for testing diff --git a/test/stress/set/set_type_std.h b/test/stress/set/set_type_std.h index 68b55b48..54e265c9 100644 --- a/test/stress/set/set_type_std.h +++ b/test/stress/set/set_type_std.h @@ -73,7 +73,7 @@ namespace set { bool contains( const Key& key ) { scoped_lock al( m_lock ); - return base_class::find( value_type(key) ) != base_class::end(); + return base_class::find( value_type(key)) != base_class::end(); } template @@ -115,15 +115,15 @@ namespace set { bool erase( const Key& key ) { scoped_lock al( m_lock ); - return base_class::erase( value_type(key) ) != 0; + return base_class::erase( value_type(key)) != 0; } template bool erase( const T& key, Func func ) { scoped_lock al( m_lock ); - typename base_class::iterator it = base_class::find( value_type(key) ); - if ( it != base_class::end() ) { + typename base_class::iterator it = base_class::find( value_type(key)); + if ( it != base_class::end()) { func( *it ); return base_class::erase( it ) != base_class::end(); } @@ -201,15 +201,15 @@ namespace set { bool erase( const Key& key ) { scoped_lock al( m_lock ); - return base_class::erase( value_type(key) ) != 0; + return base_class::erase( value_type(key)) != 0; } template bool erase( const T& key, Func func ) { scoped_lock al( m_lock ); - typename base_class::iterator it = base_class::find( value_type(key) ); - if ( it != base_class::end() ) { + typename base_class::iterator it = base_class::find( value_type(key)); + if ( it != base_class::end()) { func( *it ); base_class::erase( it ); diff --git a/test/stress/set/set_type_striped.h b/test/stress/set/set_type_striped.h index 2da0665f..94268f11 100644 --- a/test/stress/set/set_type_striped.h +++ b/test/stress/set/set_type_striped.h @@ -89,7 +89,7 @@ namespace set { public: template StripedHashSet_seq( Config const& cfg ) - : base_class( cfg.s_nSetSize / cfg.s_nLoadFactor / 16, *(new(&m_placeHolder) resizing_policy_t( cfg.s_nLoadFactor )) ) + : base_class( cfg.s_nSetSize / cfg.s_nLoadFactor / 16, *(new(&m_placeHolder) resizing_policy_t( cfg.s_nLoadFactor ))) {} empty_stat statistics() const @@ -130,7 +130,7 @@ namespace set { public: template StripedHashSet_seq_rational( Config const& cfg ) // LoadFactor = 1 / nDenominator - : base_class( cfg.s_nSetSize / cfg.s_nLoadFactor / 16, *(new(&m_placeHolder) resizing_policy_t( 1, cfg.s_nLoadFactor )) ) + : base_class( cfg.s_nSetSize / cfg.s_nLoadFactor / 16, *(new(&m_placeHolder) resizing_policy_t( 1, cfg.s_nLoadFactor ))) {} empty_stat statistics() const @@ -172,7 +172,7 @@ namespace set { public: template StripedHashSet_ord( Config const& cfg ) - : base_class( 0, *(new(&m_placeHolder) resizing_policy_t( cfg.s_nMaxLoadFactor * 1024 )) ) + : base_class( 0, *(new(&m_placeHolder) resizing_policy_t( cfg.s_nMaxLoadFactor * 1024 ))) {} empty_stat statistics() const @@ -369,7 +369,7 @@ namespace set { public: template RefinableHashSet_seq( Config const& cfg ) - : base_class( cfg.s_nSetSize / cfg.s_nLoadFactor / 16, *(new(&m_placeHolder) resizing_policy_t( cfg.s_nLoadFactor )) ) + : base_class( cfg.s_nSetSize / cfg.s_nLoadFactor / 16, *(new(&m_placeHolder) resizing_policy_t( cfg.s_nLoadFactor ))) {} empty_stat statistics() const @@ -442,7 +442,7 @@ namespace set { public: template RefinableHashSet_ord( Config const& cfg ) - : base_class( 0, *(new(&m_placeHolder) resizing_policy_t( cfg.s_nMaxLoadFactor * 1024 )) ) + : base_class( 0, *(new(&m_placeHolder) resizing_policy_t( cfg.s_nMaxLoadFactor * 1024 ))) {} empty_stat statistics() const diff --git a/test/stress/stack/intrusive_push_pop.cpp b/test/stress/stack/intrusive_push_pop.cpp index 10ab177c..da9f083a 100644 --- a/test/stress/stack/intrusive_push_pop.cpp +++ b/test/stress/stack/intrusive_push_pop.cpp @@ -89,9 +89,9 @@ namespace { { EXPECT_EQ( s.m_PushCount.get() + s.m_ActivePushCollision.get() + s.m_PassivePushCollision.get(), s_nStackSize ); EXPECT_EQ( s.m_PopCount.get() + s.m_ActivePopCollision.get() + s.m_PassivePopCollision.get(), s_nStackSize ); - EXPECT_EQ( s.m_PushCount.get(), s.m_PopCount.get() ); - EXPECT_EQ( s.m_ActivePopCollision.get(), s.m_PassivePushCollision.get() ); - EXPECT_EQ( s.m_ActivePushCollision.get(), s.m_PassivePopCollision.get() ); + EXPECT_EQ( s.m_PushCount.get(), s.m_PopCount.get()); + EXPECT_EQ( s.m_ActivePopCollision.get(), s.m_PassivePushCollision.get()); + EXPECT_EQ( s.m_ActivePushCollision.get(), s.m_PassivePopCollision.get()); } template @@ -101,7 +101,7 @@ namespace { { Stack stack( s_nEliminationSize ); do_test( stack, arrValue ); - check_elimination_stat( stack.statistics() ); + check_elimination_stat( stack.statistics()); } Stack::gc::force_dispose(); } diff --git a/test/stress/stack/intrusive_push_pop_fcstack.cpp b/test/stress/stack/intrusive_push_pop_fcstack.cpp index 0fb9fcf3..d835d621 100644 --- a/test/stress/stack/intrusive_push_pop_fcstack.cpp +++ b/test/stress/stack/intrusive_push_pop_fcstack.cpp @@ -61,7 +61,7 @@ namespace { } } - if ( args.empty() ) { + if ( args.empty()) { if ( nFCCompactFactor && nFCCombinePassCount ) args.push_back( { nFCCompactFactor, nFCCombinePassCount } ); else diff --git a/test/stress/stack/intrusive_stack_push_pop.h b/test/stress/stack/intrusive_stack_push_pop.h index 168bb8b5..4a2c33a2 100644 --- a/test/stress/stack/intrusive_stack_push_pop.h +++ b/test/stress/stack/intrusive_stack_push_pop.h @@ -107,14 +107,14 @@ namespace cds_test { virtual void test() { m_nPushError = 0; - memset( m_arrPush, 0, sizeof( m_arrPush ) ); + memset( m_arrPush, 0, sizeof( m_arrPush )); size_t i = 0; for ( typename Stack::value_type * p = m_pStart; p < m_pEnd; ++p, ++i ) { p->nProducer = id(); size_t no; p->nNo.store( no = i % c_nValArraySize, atomics::memory_order_release ); - if ( m_Stack.push( *p ) ) + if ( m_Stack.push( *p )) ++m_arrPush[no]; else ++m_nPushError; @@ -161,15 +161,15 @@ namespace cds_test { m_nPopEmpty = 0; m_nPopCount = 0; m_nDirtyPop = 0; - memset( m_arrPop, 0, sizeof( m_arrPop ) ); + memset( m_arrPop, 0, sizeof( m_arrPop )); - while ( !(s_nWorkingProducers.load( atomics::memory_order_acquire ) == 0 && m_Stack.empty()) ) { + while ( !(s_nWorkingProducers.load( atomics::memory_order_acquire ) == 0 && m_Stack.empty())) { typename Stack::value_type * p = m_Stack.pop(); if ( p ) { p->nConsumer = id(); ++m_nPopCount; size_t no = p->nNo.load( atomics::memory_order_acquire ); - if ( no < sizeof( m_arrPop ) / sizeof( m_arrPop[0] ) ) + if ( no < sizeof( m_arrPop ) / sizeof( m_arrPop[0] )) ++m_arrPop[no]; else ++m_nDirtyPop; @@ -207,7 +207,7 @@ namespace cds_test { size_t nPopEmpty = 0; size_t nPopCount = 0; size_t arrVal[c_nValArraySize]; - memset( arrVal, 0, sizeof( arrVal ) ); + memset( arrVal, 0, sizeof( arrVal )); size_t nDirtyPop = 0; for ( size_t threadNo = 0; threadNo < pool.size(); ++threadNo ) { diff --git a/test/stress/stack/intrusive_stack_type.h b/test/stress/stack/intrusive_stack_type.h index 078dc678..308237f6 100644 --- a/test/stress/stack/intrusive_stack_type.h +++ b/test/stress/stack/intrusive_stack_type.h @@ -74,7 +74,7 @@ namespace istack { T * pop() { unique_lock l( m_Lock ); - if ( !m_Impl.empty() ) { + if ( !m_Impl.empty()) { T * v = m_Impl.top(); m_Impl.pop(); return v; diff --git a/test/stress/stack/push.cpp b/test/stress/stack/push.cpp index 6ef3dee0..0a7c30e4 100644 --- a/test/stress/stack/push.cpp +++ b/test/stress/stack/push.cpp @@ -86,7 +86,7 @@ namespace { value_type v; v.nThread = id(); for ( v.nNo = m_nStartItem; v.nNo < m_nEndItem; ++v.nNo ) { - if ( !m_stack.push( v ) ) + if ( !m_stack.push( v )) ++m_nPushError; } } @@ -145,7 +145,7 @@ namespace { void test_elimination( Stack& stack ) { test( stack ); - check_elimination_stat( stack.statistics() ); + check_elimination_stat( stack.statistics()); } void check_elimination_stat( cds::container::treiber_stack::empty_stat const& ) @@ -153,7 +153,7 @@ namespace { void check_elimination_stat( cds::container::treiber_stack::stat<> const& s ) { - EXPECT_EQ( s.m_PushCount.get(), s.m_PopCount.get() ); + EXPECT_EQ( s.m_PushCount.get(), s.m_PopCount.get()); } template diff --git a/test/stress/stack/push_pop.cpp b/test/stress/stack/push_pop.cpp index 1246ea44..83acfb71 100644 --- a/test/stress/stack/push_pop.cpp +++ b/test/stress/stack/push_pop.cpp @@ -91,13 +91,13 @@ namespace { virtual void test() { - memset( m_arrPush, 0, sizeof( m_arrPush ) ); + memset( m_arrPush, 0, sizeof( m_arrPush )); value_type v; v.nThread = id(); for ( size_t i = 0; i < m_nItemCount; ++i ) { v.nNo = i % c_nValArraySize; - if ( m_stack.push( v ) ) + if ( m_stack.push( v )) ++m_arrPush[v.nNo]; else ++m_nPushError; @@ -142,13 +142,13 @@ namespace { virtual void test() { - memset( m_arrPop, 0, sizeof( m_arrPop ) ); + memset( m_arrPop, 0, sizeof( m_arrPop )); value_type v; - while ( !( s_nWorkingProducers.load( atomics::memory_order_acquire ) == 0 && m_stack.empty()) ) { - if ( m_stack.pop( v ) ) { + while ( !( s_nWorkingProducers.load( atomics::memory_order_acquire ) == 0 && m_stack.empty())) { + if ( m_stack.pop( v )) { ++m_nPopCount; - if ( v.nNo < sizeof( m_arrPop ) / sizeof( m_arrPop[0] ) ) + if ( v.nNo < sizeof( m_arrPop ) / sizeof( m_arrPop[0] )) ++m_arrPop[v.nNo]; else ++m_nDirtyPop; @@ -214,7 +214,7 @@ namespace { void test_elimination( Stack& stack ) { test( stack ); - check_elimination_stat( stack.statistics() ); + check_elimination_stat( stack.statistics()); } void check_elimination_stat( cds::container::treiber_stack::empty_stat const& ) @@ -224,9 +224,9 @@ namespace { { EXPECT_EQ( s.m_PushCount.get() + s.m_ActivePushCollision.get() + s.m_PassivePushCollision.get(), s_nStackSize ); EXPECT_EQ( s.m_PopCount.get() + s.m_ActivePopCollision.get() + s.m_PassivePopCollision.get(), s_nStackSize ); - EXPECT_EQ( s.m_PushCount.get(), s.m_PopCount.get() ); - EXPECT_EQ( s.m_ActivePopCollision.get(), s.m_PassivePushCollision.get() ); - EXPECT_EQ( s.m_ActivePushCollision.get(), s.m_PassivePopCollision.get() ); + EXPECT_EQ( s.m_PushCount.get(), s.m_PopCount.get()); + EXPECT_EQ( s.m_ActivePopCollision.get(), s.m_PassivePushCollision.get()); + EXPECT_EQ( s.m_ActivePushCollision.get(), s.m_PassivePopCollision.get()); } template< class Stack> @@ -238,7 +238,7 @@ namespace { size_t nPopEmpty = 0; size_t nPopCount = 0; size_t arrVal[c_nValArraySize]; - memset( arrVal, 0, sizeof( arrVal ) ); + memset( arrVal, 0, sizeof( arrVal )); size_t nDirtyPop = 0; for ( size_t threadNo = 0; threadNo < pool.size(); ++threadNo ) { diff --git a/test/stress/stack/stack_type.h b/test/stress/stack/stack_type.h index be262c88..5c1dff20 100644 --- a/test/stress/stack/stack_type.h +++ b/test/stress/stack/stack_type.h @@ -123,7 +123,7 @@ namespace stack { bool pop( T& v ) { unique_lock l( m_Lock ); - if ( !m_Impl.empty() ) { + if ( !m_Impl.empty()) { v = m_Impl.top(); m_Impl.pop(); return true; diff --git a/test/unit/deque/fcdeque.cpp b/test/unit/deque/fcdeque.cpp index 3968f0cb..d8e5b367 100644 --- a/test/unit/deque/fcdeque.cpp +++ b/test/unit/deque/fcdeque.cpp @@ -44,13 +44,13 @@ namespace { // push_front/pop_front for ( int i = 0; i < static_cast( c_nSize ); ++i ) - EXPECT_TRUE( dq.push_front( i ) ); + EXPECT_TRUE( dq.push_front( i )); EXPECT_EQ( dq.size(), c_nSize ); size_t nCount = 0; int val; - while ( !dq.empty() ) { - EXPECT_TRUE( dq.pop_front( val ) ); + while ( !dq.empty()) { + EXPECT_TRUE( dq.pop_front( val )); ++nCount; EXPECT_EQ( static_cast(c_nSize - nCount), val ); } @@ -58,12 +58,12 @@ namespace { // push_back/pop_back for ( int i = 0; i < static_cast( c_nSize ); ++i ) - EXPECT_TRUE( dq.push_back( i ) ); + EXPECT_TRUE( dq.push_back( i )); EXPECT_EQ( dq.size(), c_nSize ); nCount = 0; - while ( !dq.empty() ) { - EXPECT_TRUE( dq.pop_back( val ) ); + while ( !dq.empty()) { + EXPECT_TRUE( dq.pop_back( val )); ++nCount; EXPECT_EQ( static_cast(c_nSize - nCount), val ); } @@ -71,12 +71,12 @@ namespace { // push_back/pop_front for ( int i = 0; i < static_cast( c_nSize ); ++i ) - EXPECT_TRUE( dq.push_back( i ) ); + EXPECT_TRUE( dq.push_back( i )); EXPECT_EQ( dq.size(), c_nSize ); nCount = 0; - while ( !dq.empty() ) { - EXPECT_TRUE( dq.pop_front( val ) ); + while ( !dq.empty()) { + EXPECT_TRUE( dq.pop_front( val )); EXPECT_EQ( static_cast( nCount ), val ); ++nCount; } @@ -84,12 +84,12 @@ namespace { // push_front/pop_back for ( int i = 0; i < static_cast( c_nSize ); ++i ) - EXPECT_TRUE( dq.push_front( i ) ); + EXPECT_TRUE( dq.push_front( i )); EXPECT_EQ( dq.size(), c_nSize ); nCount = 0; - while ( !dq.empty() ) { - EXPECT_TRUE( dq.pop_back( val ) ); + while ( !dq.empty()) { + EXPECT_TRUE( dq.pop_back( val )); EXPECT_EQ( static_cast( nCount ), val ); ++nCount; } @@ -97,12 +97,12 @@ namespace { // clear for ( int i = 0; i < static_cast( c_nSize ); ++i ) - EXPECT_TRUE( dq.push_front( i ) ); + EXPECT_TRUE( dq.push_front( i )); EXPECT_EQ( dq.size(), c_nSize ); - EXPECT_FALSE( dq.empty() ); + EXPECT_FALSE( dq.empty()); dq.clear(); - EXPECT_TRUE( dq.empty() ); + EXPECT_TRUE( dq.empty()); } }; diff --git a/test/unit/intrusive-list/test_intrusive_iterable_list.h b/test/unit/intrusive-list/test_intrusive_iterable_list.h index 278b16ca..5d45600d 100644 --- a/test/unit/intrusive-list/test_intrusive_iterable_list.h +++ b/test/unit/intrusive-list/test_intrusive_iterable_list.h @@ -62,7 +62,7 @@ namespace cds_test { stat& operator =( const stat& s ) { - memcpy( this, &s, sizeof( s ) ); + memcpy( this, &s, sizeof( s )); return *this; } }; @@ -150,7 +150,7 @@ namespace cds_test { struct cmp { int operator ()( const T& v1, const T& v2 ) const { - if ( v1.key() < v2.key() ) + if ( v1.key() < v2.key()) return -1; return v1.key() > v2.key() ? 1 : 0; } @@ -166,7 +166,7 @@ namespace cds_test { template int operator ()( const Q& v1, const T& v2 ) const { - if ( v1 < v2.key() ) + if ( v1 < v2.key()) return -1; return v1 > v2.key() ? 1 : 0; } @@ -232,7 +232,7 @@ namespace cds_test { shuffle( arr, arr + nSize ); shuffle( arr2, arr2 + nSize ); - ASSERT_TRUE( l.empty() ); + ASSERT_TRUE( l.empty()); ASSERT_CONTAINER_SIZE( l, 0 ); typedef typename List::iterator iterator; @@ -293,7 +293,7 @@ namespace cds_test { EXPECT_TRUE( l.contains( i.nKey )); EXPECT_TRUE( l.contains( i )); EXPECT_TRUE( l.contains( other_item( i.nKey ), other_less())); - EXPECT_FALSE( l.find( i.nKey ) == l.end() ); + EXPECT_FALSE( l.find( i.nKey ) == l.end()); EXPECT_TRUE( l.find( i.nKey, []( value_type& item, int ) { ++item.s.nFindCall; } )); EXPECT_EQ( i.s.nFindCall, 1 ); EXPECT_TRUE( l.find( i, []( value_type& item, value_type const& ) { ++item.s.nFindCall; } )); @@ -301,27 +301,27 @@ namespace cds_test { EXPECT_TRUE( l.find_with( other_item( i.nKey ), other_less(), []( value_type& item, other_item const& ) { ++item.s.nFindCall; } )); EXPECT_EQ( i.s.nFindCall, 3 ); - EXPECT_FALSE( l.insert( i ) ); - ASSERT_FALSE( l.empty() ); + EXPECT_FALSE( l.insert( i )); + ASSERT_FALSE( l.empty()); int const ckey = i.nKey; iterator it = l.find( ckey ); - ASSERT_FALSE( it == l.end() ); + ASSERT_FALSE( it == l.end()); EXPECT_EQ( it->nKey, i.nKey ); EXPECT_EQ( (*it).nVal, i.nVal ); - check_ordered( it, l.end() ); + check_ordered( it, l.end()); it = l.find( i.nKey ); - ASSERT_FALSE( it == l.end() ); + ASSERT_FALSE( it == l.end()); EXPECT_EQ( it->nKey, i.nKey ); EXPECT_EQ( (*it).nVal, i.nVal ); - check_ordered( it, l.end() ); + check_ordered( it, l.end()); - it = l.find_with( other_item( i.nKey ), other_less() ); - ASSERT_FALSE( it == l.end() ); + it = l.find_with( other_item( i.nKey ), other_less()); + ASSERT_FALSE( it == l.end()); EXPECT_EQ( it->nKey, i.nKey ); EXPECT_EQ( it->nVal, i.nVal ); - check_ordered( it, l.end() ); + check_ordered( it, l.end()); } ASSERT_CONTAINER_SIZE( l, nSize ); @@ -338,13 +338,13 @@ namespace cds_test { EXPECT_TRUE( l.find_with( other_item( i.nKey ), other_less(), []( value_type& item, other_item const& ) { ++item.s.nFindCall; } )); EXPECT_EQ( i.s.nFindCall, 6 ); } - ASSERT_FALSE( l.empty() ); + ASSERT_FALSE( l.empty()); ASSERT_CONTAINER_SIZE( l, nSize ); // update existing test for ( auto& i : arr2 ) { EXPECT_EQ( i.s.nUpdateExistsCall, 0 ); - std::pair ret = l.update( i, update_functor() ); + std::pair ret = l.update( i, update_functor()); EXPECT_TRUE( ret.first ); EXPECT_FALSE( ret.second ); EXPECT_EQ( i.s.nUpdateExistsCall, 1 ); @@ -353,7 +353,7 @@ namespace cds_test { // update with the same value must be empty - no functor is called for ( auto& i : arr2 ) { EXPECT_EQ( i.s.nUpdateExistsCall, 1 ); - std::pair ret = l.update( i, update_functor() ); + std::pair ret = l.update( i, update_functor()); EXPECT_TRUE( ret.first ); EXPECT_FALSE( ret.second ); EXPECT_EQ( i.s.nUpdateExistsCall, 1 ); @@ -379,11 +379,11 @@ namespace cds_test { if ( i.nKey & 1 ) EXPECT_TRUE( l.erase( i.nKey )); else - EXPECT_TRUE( l.erase_with( other_item( i.nKey ), other_less() )); + EXPECT_TRUE( l.erase_with( other_item( i.nKey ), other_less())); EXPECT_FALSE( l.contains( i )); } - EXPECT_TRUE( l.empty() ); + EXPECT_TRUE( l.empty()); EXPECT_CONTAINER_SIZE( l, 0 ); // Apply retired pointer to clean links @@ -407,7 +407,7 @@ namespace cds_test { EXPECT_TRUE( ret.second ); EXPECT_EQ( i.s.nUpdateNewCall, updateNewCall + 1 ); } - EXPECT_FALSE( l.empty() ); + EXPECT_FALSE( l.empty()); EXPECT_CONTAINER_SIZE( l, nSize ); for ( auto const& i : arr ) { @@ -423,7 +423,7 @@ namespace cds_test { EXPECT_EQ( i.s.nEraseCall, 1 ); EXPECT_FALSE( l.contains( i.nKey )); } - EXPECT_TRUE( l.empty() ); + EXPECT_TRUE( l.empty()); EXPECT_CONTAINER_SIZE( l, 0 ); // Apply retired pointer to clean links @@ -436,12 +436,12 @@ namespace cds_test { for ( auto& i : arr ) EXPECT_TRUE( l.insert( i )); - EXPECT_FALSE( l.empty() ); + EXPECT_FALSE( l.empty()); EXPECT_CONTAINER_SIZE( l, nSize ); l.clear(); - EXPECT_TRUE( l.empty() ); + EXPECT_TRUE( l.empty()); EXPECT_CONTAINER_SIZE( l, 0 ); // Apply retired pointer to clean links @@ -453,24 +453,24 @@ namespace cds_test { // unlink test for ( auto& i : arr ) - EXPECT_TRUE( l.insert( i ) ); + EXPECT_TRUE( l.insert( i )); for ( auto& i : arr ) { value_type val( i ); EXPECT_TRUE( l.contains( val )); EXPECT_FALSE( l.unlink( val )); - EXPECT_TRUE( l.contains( val ) ); + EXPECT_TRUE( l.contains( val )); EXPECT_TRUE( l.unlink( i )); EXPECT_FALSE( l.unlink( i )); - EXPECT_FALSE( l.contains( i ) ); + EXPECT_FALSE( l.contains( i )); } - EXPECT_TRUE( l.empty() ); + EXPECT_TRUE( l.empty()); EXPECT_CONTAINER_SIZE( l, 0 ); // Apply retired pointer to clean links List::gc::force_dispose(); for ( auto const& i : arr ) { EXPECT_EQ( i.s.nDisposeCount, 5 ); - EXPECT_FALSE( l.contains( i ) ); + EXPECT_FALSE( l.contains( i )); } // Iterators on empty list @@ -509,11 +509,11 @@ namespace cds_test { } shuffle( arr, arr + nSize ); - ASSERT_TRUE( l.empty() ); + ASSERT_TRUE( l.empty()); ASSERT_CONTAINER_SIZE( l, 0 ); for ( auto& i : arr ) - EXPECT_TRUE( l.insert( i ) ); + EXPECT_TRUE( l.insert( i )); int key = 0; for ( auto it = l.begin(); it != l.end(); ++it ) { @@ -533,7 +533,7 @@ namespace cds_test { List::gc::force_dispose(); for ( auto const& i : arr ) { EXPECT_EQ( i.s.nDisposeCount, 1 ); - EXPECT_FALSE( l.contains( i ) ); + EXPECT_FALSE( l.contains( i )); } } diff --git a/test/unit/intrusive-list/test_intrusive_iterable_list_hp.h b/test/unit/intrusive-list/test_intrusive_iterable_list_hp.h index f3faa224..1a7983ff 100644 --- a/test/unit/intrusive-list/test_intrusive_iterable_list_hp.h +++ b/test/unit/intrusive-list/test_intrusive_iterable_list_hp.h @@ -55,7 +55,7 @@ namespace cds_test { typedef typename List::guarded_ptr guarded_ptr; - ASSERT_TRUE( l.empty() ); + ASSERT_TRUE( l.empty()); ASSERT_CONTAINER_SIZE( l, 0 ); guarded_ptr gp; @@ -64,16 +64,16 @@ namespace cds_test { for ( auto& i : arr ) { gp = l.get( i.nKey ); EXPECT_TRUE( !gp ); - gp = l.get_with( other_item( i.nKey ), other_less() ); + gp = l.get_with( other_item( i.nKey ), other_less()); EXPECT_TRUE( !gp ); - EXPECT_TRUE( l.insert( i ) ); + EXPECT_TRUE( l.insert( i )); gp = l.get( i.nKey ); ASSERT_FALSE( !gp ); EXPECT_EQ( gp->nKey, i.nKey ); EXPECT_EQ( gp->nVal, i.nVal ); - gp = l.get_with( other_item( i.nKey ), other_less() ); + gp = l.get_with( other_item( i.nKey ), other_less()); ASSERT_FALSE( !gp ); EXPECT_EQ( gp->nKey, i.nKey ); EXPECT_EQ( gp->nVal, i.nVal ); @@ -84,23 +84,23 @@ namespace cds_test { if ( i & 1 ) gp = l.extract( i ); else - gp = l.extract_with( other_item( i ), other_less() ); + gp = l.extract_with( other_item( i ), other_less()); ASSERT_FALSE( !gp ); EXPECT_EQ( gp->nKey, i ); gp = l.extract( i ); EXPECT_TRUE( !gp ); - gp = l.extract_with( other_item( i ), other_less() ); + gp = l.extract_with( other_item( i ), other_less()); EXPECT_TRUE( !gp ); } - ASSERT_TRUE( l.empty() ); + ASSERT_TRUE( l.empty()); ASSERT_CONTAINER_SIZE( l, 0 ); List::gc::force_dispose(); for ( auto const& i : arr ) { EXPECT_EQ( i.s.nDisposeCount, 1 ); - EXPECT_FALSE( l.contains( i ) ); + EXPECT_FALSE( l.contains( i )); } } }; diff --git a/test/unit/intrusive-list/test_intrusive_list.h b/test/unit/intrusive-list/test_intrusive_list.h index dae49ae0..563fb70d 100644 --- a/test/unit/intrusive-list/test_intrusive_list.h +++ b/test/unit/intrusive-list/test_intrusive_list.h @@ -62,7 +62,7 @@ namespace cds_test { stat& operator =( const stat& s ) { - memcpy( this, &s, sizeof( s ) ); + memcpy( this, &s, sizeof( s )); return *this; } }; @@ -194,7 +194,7 @@ namespace cds_test { struct cmp { int operator ()( const T& v1, const T& v2 ) const { - if ( v1.key() < v2.key() ) + if ( v1.key() < v2.key()) return -1; return v1.key() > v2.key() ? 1 : 0; } @@ -210,7 +210,7 @@ namespace cds_test { template int operator ()( const Q& v1, const T& v2 ) const { - if ( v1 < v2.key() ) + if ( v1 < v2.key()) return -1; return v1 > v2.key() ? 1 : 0; } @@ -272,7 +272,7 @@ namespace cds_test { } shuffle( arr, arr + nSize ); - ASSERT_TRUE( l.empty() ); + ASSERT_TRUE( l.empty()); ASSERT_CONTAINER_SIZE( l, 0 ); // insert / find @@ -302,8 +302,8 @@ namespace cds_test { EXPECT_TRUE( l.find_with( other_item( i.nKey ), other_less(), []( value_type& item, other_item const& ) { ++item.s.nFindCall; } )); EXPECT_EQ( i.s.nFindCall, 3 ); - EXPECT_FALSE( l.insert( i ) ); - ASSERT_FALSE( l.empty() ); + EXPECT_FALSE( l.insert( i )); + ASSERT_FALSE( l.empty()); } ASSERT_CONTAINER_SIZE( l, nSize ); @@ -319,13 +319,13 @@ namespace cds_test { EXPECT_TRUE( l.find_with( other_item( i.nKey ), other_less(), []( value_type& item, other_item const& ) { ++item.s.nFindCall; } )); EXPECT_EQ( i.s.nFindCall, 6 ); } - ASSERT_FALSE( l.empty() ); + ASSERT_FALSE( l.empty()); ASSERT_CONTAINER_SIZE( l, nSize ); // update existing test for ( auto& i : arr ) { EXPECT_EQ( i.s.nUpdateExistsCall, 0 ); - std::pair ret = l.update( i, update_functor() ); + std::pair ret = l.update( i, update_functor()); EXPECT_TRUE( ret.first ); EXPECT_FALSE( ret.second ); EXPECT_EQ( i.s.nUpdateExistsCall, 1 ); @@ -346,11 +346,11 @@ namespace cds_test { if ( i.nKey & 1 ) EXPECT_TRUE( l.erase( i.nKey )); else - EXPECT_TRUE( l.erase_with( other_item( i.nKey ), other_less() )); + EXPECT_TRUE( l.erase_with( other_item( i.nKey ), other_less())); EXPECT_FALSE( l.contains( i )); } - EXPECT_TRUE( l.empty() ); + EXPECT_TRUE( l.empty()); EXPECT_CONTAINER_SIZE( l, 0 ); // Apply retired pointer to clean links @@ -370,7 +370,7 @@ namespace cds_test { EXPECT_TRUE( ret.second ); EXPECT_EQ( i.s.nUpdateNewCall, 1 ); } - EXPECT_FALSE( l.empty() ); + EXPECT_FALSE( l.empty()); EXPECT_CONTAINER_SIZE( l, nSize ); for ( auto const& i : arr ) { @@ -386,7 +386,7 @@ namespace cds_test { EXPECT_EQ( i.s.nEraseCall, 1 ); EXPECT_FALSE( l.contains( i.nKey )); } - EXPECT_TRUE( l.empty() ); + EXPECT_TRUE( l.empty()); EXPECT_CONTAINER_SIZE( l, 0 ); // Apply retired pointer to clean links @@ -399,12 +399,12 @@ namespace cds_test { for ( auto& i : arr ) EXPECT_TRUE( l.insert( i )); - EXPECT_FALSE( l.empty() ); + EXPECT_FALSE( l.empty()); EXPECT_CONTAINER_SIZE( l, nSize ); l.clear(); - EXPECT_TRUE( l.empty() ); + EXPECT_TRUE( l.empty()); EXPECT_CONTAINER_SIZE( l, 0 ); // Apply retired pointer to clean links @@ -416,24 +416,24 @@ namespace cds_test { // unlink test for ( auto& i : arr ) - EXPECT_TRUE( l.insert( i ) ); + EXPECT_TRUE( l.insert( i )); for ( auto& i : arr ) { value_type val( i ); EXPECT_TRUE( l.contains( val )); EXPECT_FALSE( l.unlink( val )); - EXPECT_TRUE( l.contains( val ) ); + EXPECT_TRUE( l.contains( val )); EXPECT_TRUE( l.unlink( i )); EXPECT_FALSE( l.unlink( i )); - EXPECT_FALSE( l.contains( i ) ); + EXPECT_FALSE( l.contains( i )); } - EXPECT_TRUE( l.empty() ); + EXPECT_TRUE( l.empty()); EXPECT_CONTAINER_SIZE( l, 0 ); // Apply retired pointer to clean links List::gc::force_dispose(); for ( auto const& i : arr ) { EXPECT_EQ( i.s.nDisposeCount, 4 ); - EXPECT_FALSE( l.contains( i ) ); + EXPECT_FALSE( l.contains( i )); } // Iterators on empty list @@ -472,11 +472,11 @@ namespace cds_test { } shuffle( arr, arr + nSize ); - ASSERT_TRUE( l.empty() ); + ASSERT_TRUE( l.empty()); ASSERT_CONTAINER_SIZE( l, 0 ); for ( auto& i : arr ) - EXPECT_TRUE( l.insert( i ) ); + EXPECT_TRUE( l.insert( i )); int key = 0; for ( auto it = l.begin(); it != l.end(); ++it ) { @@ -496,7 +496,7 @@ namespace cds_test { List::gc::force_dispose(); for ( auto const& i : arr ) { EXPECT_EQ( i.s.nDisposeCount, 1 ); - EXPECT_FALSE( l.contains( i ) ); + EXPECT_FALSE( l.contains( i )); } } }; diff --git a/test/unit/intrusive-list/test_intrusive_list_hp.h b/test/unit/intrusive-list/test_intrusive_list_hp.h index 0d3936a2..dab47f13 100644 --- a/test/unit/intrusive-list/test_intrusive_list_hp.h +++ b/test/unit/intrusive-list/test_intrusive_list_hp.h @@ -55,7 +55,7 @@ namespace cds_test { typedef typename List::guarded_ptr guarded_ptr; - ASSERT_TRUE( l.empty() ); + ASSERT_TRUE( l.empty()); ASSERT_CONTAINER_SIZE( l, 0 ); guarded_ptr gp; @@ -73,7 +73,7 @@ namespace cds_test { ASSERT_FALSE( !gp ); EXPECT_EQ( gp->nKey, i.nKey ); EXPECT_EQ( gp->nVal, i.nVal ); - gp = l.get_with( other_item( i.nKey ), other_less() ); + gp = l.get_with( other_item( i.nKey ), other_less()); ASSERT_FALSE( !gp ); EXPECT_EQ( gp->nKey, i.nKey ); EXPECT_EQ( gp->nVal, i.nVal ); @@ -90,17 +90,17 @@ namespace cds_test { gp = l.extract( i ); EXPECT_TRUE( !gp ); - gp = l.extract_with( other_item( i ), other_less() ); + gp = l.extract_with( other_item( i ), other_less()); EXPECT_TRUE( !gp ); } - ASSERT_TRUE( l.empty() ); + ASSERT_TRUE( l.empty()); ASSERT_CONTAINER_SIZE( l, 0 ); List::gc::force_dispose(); for ( auto const& i : arr ) { EXPECT_EQ( i.s.nDisposeCount, 1 ); - EXPECT_FALSE( l.contains( i ) ); + EXPECT_FALSE( l.contains( i )); } } }; diff --git a/test/unit/intrusive-list/test_intrusive_list_nogc.h b/test/unit/intrusive-list/test_intrusive_list_nogc.h index d1aa273e..69f636f3 100644 --- a/test/unit/intrusive-list/test_intrusive_list_nogc.h +++ b/test/unit/intrusive-list/test_intrusive_list_nogc.h @@ -58,7 +58,7 @@ namespace cds_test { stat& operator =( const stat& s ) { - memcpy( this, &s, sizeof( s ) ); + memcpy( this, &s, sizeof( s )); return *this; } }; @@ -190,7 +190,7 @@ namespace cds_test { struct cmp { int operator ()( const T& v1, const T& v2 ) const { - if ( v1.key() < v2.key() ) + if ( v1.key() < v2.key()) return -1; return v1.key() > v2.key() ? 1 : 0; } @@ -206,7 +206,7 @@ namespace cds_test { template int operator ()( const Q& v1, const T& v2 ) const { - if ( v1 < v2.key() ) + if ( v1 < v2.key()) return -1; return v1 > v2.key() ? 1 : 0; } @@ -277,7 +277,7 @@ namespace cds_test { } shuffle( arr, arr + nSize ); - ASSERT_TRUE( l.empty() ); + ASSERT_TRUE( l.empty()); ASSERT_CONTAINER_SIZE( l, 0 ); // insert / find @@ -301,8 +301,8 @@ namespace cds_test { EXPECT_TRUE( l.find_with( other_item( i.nKey ), other_less(), []( value_type& item, other_item const& ) { ++item.s.nFindCall; } )); EXPECT_EQ( i.s.nFindCall, 3 ); - EXPECT_FALSE( l.insert( i ) ); - ASSERT_FALSE( l.empty() ); + EXPECT_FALSE( l.insert( i )); + ASSERT_FALSE( l.empty()); } ASSERT_CONTAINER_SIZE( l, nSize ); @@ -318,13 +318,13 @@ namespace cds_test { EXPECT_TRUE( l.find_with( other_item( i.nKey ), other_less(), []( value_type& item, other_item const& ) { ++item.s.nFindCall; } )); EXPECT_EQ( i.s.nFindCall, 6 ); } - ASSERT_FALSE( l.empty() ); + ASSERT_FALSE( l.empty()); ASSERT_CONTAINER_SIZE( l, nSize ); // update existing test for ( auto& i : arr ) { EXPECT_EQ( i.s.nUpdateExistsCall, 0 ); - std::pair ret = l.update( i, update_functor() ); + std::pair ret = l.update( i, update_functor()); EXPECT_TRUE( ret.first ); EXPECT_FALSE( ret.second ); EXPECT_EQ( i.s.nUpdateExistsCall, 1 ); @@ -342,14 +342,14 @@ namespace cds_test { // clear() test l.clear(); - EXPECT_TRUE( l.empty() ); + EXPECT_TRUE( l.empty()); EXPECT_CONTAINER_SIZE( l, 0 ); // Apply retired pointer to clean links List::gc::force_dispose(); for ( auto const& i : arr ) { EXPECT_EQ( i.s.nDisposeCount, 1 ); - EXPECT_FALSE( l.contains( i ) ); + EXPECT_FALSE( l.contains( i )); } @@ -364,12 +364,12 @@ namespace cds_test { EXPECT_EQ( i.s.nUpdateNewCall, 1 ); } - EXPECT_FALSE( l.empty() ); + EXPECT_FALSE( l.empty()); EXPECT_CONTAINER_SIZE( l, nSize ); l.clear( mock_disposer2()); - EXPECT_TRUE( l.empty() ); + EXPECT_TRUE( l.empty()); EXPECT_CONTAINER_SIZE( l, 0 ); // Apply retired pointer to clean links @@ -415,11 +415,11 @@ namespace cds_test { } shuffle( arr, arr + nSize ); - ASSERT_TRUE( l.empty() ); + ASSERT_TRUE( l.empty()); ASSERT_CONTAINER_SIZE( l, 0 ); for ( auto& i : arr ) - EXPECT_TRUE( l.insert( i ) ); + EXPECT_TRUE( l.insert( i )); int key = 0; for ( auto it = l.begin(); it != l.end(); ++it ) { @@ -439,7 +439,7 @@ namespace cds_test { List::gc::force_dispose(); for ( auto const& i : arr ) { EXPECT_EQ( i.s.nDisposeCount, 1 ); - EXPECT_FALSE( l.contains( i ) ); + EXPECT_FALSE( l.contains( i )); } } @@ -459,11 +459,11 @@ namespace cds_test { } shuffle( arr, arr + nSize ); - ASSERT_TRUE( l.empty() ); + ASSERT_TRUE( l.empty()); ASSERT_CONTAINER_SIZE( l, 0 ); for ( auto& i : arr ) - EXPECT_TRUE( l.insert( i ) ); + EXPECT_TRUE( l.insert( i )); size_t idx = 0; for ( auto it = l.begin(); it != l.end(); ++it, ++idx ) { @@ -483,7 +483,7 @@ namespace cds_test { List::gc::force_dispose(); for ( auto const& i : arr ) { EXPECT_EQ( i.s.nDisposeCount, 1 ); - EXPECT_FALSE( l.contains( i ) ); + EXPECT_FALSE( l.contains( i )); } } }; diff --git a/test/unit/intrusive-list/test_intrusive_list_rcu.h b/test/unit/intrusive-list/test_intrusive_list_rcu.h index ecc764de..ac2a4e3a 100644 --- a/test/unit/intrusive-list/test_intrusive_list_rcu.h +++ b/test/unit/intrusive-list/test_intrusive_list_rcu.h @@ -57,7 +57,7 @@ namespace cds_test { typedef typename List::raw_ptr raw_ptr; typedef typename List::rcu_lock rcu_lock; - ASSERT_TRUE( l.empty() ); + ASSERT_TRUE( l.empty()); ASSERT_CONTAINER_SIZE( l, 0 ); // get() test @@ -81,7 +81,7 @@ namespace cds_test { } { rcu_lock lock; - raw_ptr rp = l.get_with( other_item( i.nKey ), other_less() ); + raw_ptr rp = l.get_with( other_item( i.nKey ), other_less()); ASSERT_FALSE( !rp ); EXPECT_EQ( rp->nKey, i.nKey ); EXPECT_EQ( rp->nVal, i.nVal ); @@ -109,7 +109,7 @@ namespace cds_test { gp = l.extract( i ); EXPECT_TRUE( !gp ); - gp = l.extract_with( other_item( i ), other_less() ); + gp = l.extract_with( other_item( i ), other_less()); EXPECT_TRUE( !gp ); } } @@ -119,24 +119,24 @@ namespace cds_test { if ( i & 1 ) gp = l.extract( i ); else - gp = l.extract_with( other_item( i ), other_less() ); + gp = l.extract_with( other_item( i ), other_less()); ASSERT_FALSE( !gp ); EXPECT_EQ( gp->nKey, i ); gp = l.extract( i ); EXPECT_TRUE( !gp ); - gp = l.extract_with( other_item( i ), other_less() ); + gp = l.extract_with( other_item( i ), other_less()); EXPECT_TRUE( !gp ); } } - ASSERT_TRUE( l.empty() ); + ASSERT_TRUE( l.empty()); ASSERT_CONTAINER_SIZE( l, 0 ); List::gc::force_dispose(); for ( auto const& i : arr ) { EXPECT_EQ( i.s.nDisposeCount, 1 ); - EXPECT_FALSE( l.contains( i ) ); + EXPECT_FALSE( l.contains( i )); } } }; diff --git a/test/unit/intrusive-set/test_intrusive_feldman_hashset.h b/test/unit/intrusive-set/test_intrusive_feldman_hashset.h index 476a2417..c0e16d23 100644 --- a/test/unit/intrusive-set/test_intrusive_feldman_hashset.h +++ b/test/unit/intrusive-set/test_intrusive_feldman_hashset.h @@ -59,7 +59,7 @@ namespace cds_test { void clear_stat() { - memset( this, 0, sizeof( *this ) ); + memset( this, 0, sizeof( *this )); } }; @@ -153,9 +153,9 @@ namespace cds_test { // Precondition: set is empty // Postcondition: set is empty - ASSERT_TRUE( s.empty() ); + ASSERT_TRUE( s.empty()); ASSERT_CONTAINER_SIZE( s, 0 ); - size_t const nSetSize = std::max( s.head_size() * 2, static_cast(100) ); + size_t const nSetSize = std::max( s.head_size() * 2, static_cast(100)); typedef typename Set::value_type value_type; @@ -167,7 +167,7 @@ namespace cds_test { data.push_back( value_type( static_cast( key ))); indices.push_back( key ); } - shuffle( indices.begin(), indices.end() ); + shuffle( indices.begin(), indices.end()); // insert/find for ( auto idx : indices ) { @@ -194,7 +194,7 @@ namespace cds_test { EXPECT_EQ( i.nInsertCount, 0u ); ASSERT_TRUE( s.insert( i, []( value_type& v ) { ++v.nInsertCount;} )); EXPECT_EQ( i.nInsertCount, 1u ); - ASSERT_FALSE( s.insert( i, []( value_type& v ) { ++v.nInsertCount;} ) ); + ASSERT_FALSE( s.insert( i, []( value_type& v ) { ++v.nInsertCount;} )); EXPECT_EQ( i.nInsertCount, 1u ); i.nInsertCount = 0; break; @@ -205,12 +205,12 @@ namespace cds_test { break; } - ASSERT_TRUE( s.contains( i.nKey ) ); + ASSERT_TRUE( s.contains( i.nKey )); EXPECT_EQ( i.nFindCount, 0u ); ASSERT_TRUE( s.find( i.nKey, []( value_type& v ) { ++v.nFindCount; } )); EXPECT_EQ( i.nFindCount, 1u ); } - ASSERT_FALSE( s.empty() ); + ASSERT_FALSE( s.empty()); ASSERT_CONTAINER_SIZE( s, nSetSize ); std::for_each( data.begin(), data.end(), []( value_type& v ) { v.clear_stat(); }); @@ -223,13 +223,13 @@ namespace cds_test { } // erase - shuffle( indices.begin(), indices.end() ); + shuffle( indices.begin(), indices.end()); for ( auto idx : indices ) { auto& i = data[ idx ]; - ASSERT_TRUE( s.contains( i.nKey ) ); + ASSERT_TRUE( s.contains( i.nKey )); EXPECT_EQ( i.nFindCount, 0u ); - ASSERT_TRUE( s.find( i.nKey, []( value_type& v ) { ++v.nFindCount; } ) ); + ASSERT_TRUE( s.find( i.nKey, []( value_type& v ) { ++v.nFindCount; } )); EXPECT_EQ( i.nFindCount, 1u ); value_type v( i ); @@ -237,11 +237,11 @@ namespace cds_test { case 0: ASSERT_FALSE( s.unlink( v )); ASSERT_TRUE( s.unlink( i )); - ASSERT_FALSE( s.unlink( i ) ); + ASSERT_FALSE( s.unlink( i )); break; case 1: ASSERT_TRUE( s.erase( i.key())); - ASSERT_FALSE( s.erase( i.key() ) ); + ASSERT_FALSE( s.erase( i.key()) ); break; case 2: EXPECT_EQ( i.nEraseCount, 0u ); @@ -255,7 +255,7 @@ namespace cds_test { ASSERT_FALSE( s.contains( i.nKey )); ASSERT_FALSE( s.find( i.nKey, []( value_type const& ) {} )); } - ASSERT_TRUE( s.empty() ); + ASSERT_TRUE( s.empty()); ASSERT_CONTAINER_SIZE( s, 0 ); // Force retiring cycle @@ -269,7 +269,7 @@ namespace cds_test { i.clear_stat(); ASSERT_TRUE( s.insert( i )); } - ASSERT_FALSE( s.empty() ); + ASSERT_FALSE( s.empty()); ASSERT_CONTAINER_SIZE( s, nSetSize ); // Forward iterator test @@ -297,8 +297,8 @@ namespace cds_test { ASSERT_TRUE( s.empty()); ASSERT_CONTAINER_SIZE( s, 0u ); - ASSERT_TRUE( s.begin() == s.end() ); - ASSERT_TRUE( s.cbegin() == s.cend() ); + ASSERT_TRUE( s.begin() == s.end()); + ASSERT_TRUE( s.cbegin() == s.cend()); // Force retiring cycle Set::gc::force_dispose(); diff --git a/test/unit/intrusive-set/test_intrusive_feldman_hashset_hp.h b/test/unit/intrusive-set/test_intrusive_feldman_hashset_hp.h index 9036861d..e5b1507d 100644 --- a/test/unit/intrusive-set/test_intrusive_feldman_hashset_hp.h +++ b/test/unit/intrusive-set/test_intrusive_feldman_hashset_hp.h @@ -49,7 +49,7 @@ namespace cds_test { base_class::test( s ); - ASSERT_TRUE( s.empty() ); + ASSERT_TRUE( s.empty()); ASSERT_CONTAINER_SIZE( s, 0 ); typedef typename Set::value_type value_type; @@ -60,10 +60,10 @@ namespace cds_test { data.reserve( nSetSize ); indices.reserve( nSetSize ); for ( size_t key = 0; key < nSetSize; ++key ) { - data.push_back( value_type( static_cast(key) ) ); + data.push_back( value_type( static_cast(key)) ); indices.push_back( key ); } - shuffle( indices.begin(), indices.end() ); + shuffle( indices.begin(), indices.end()); typename Set::guarded_ptr gp; @@ -71,7 +71,7 @@ namespace cds_test { for ( auto idx : indices ) { auto& i = data[idx]; - gp = s.get( i.key() ); + gp = s.get( i.key()); ASSERT_TRUE( !gp ); gp = s.extract( i.key()); @@ -81,7 +81,7 @@ namespace cds_test { // fill set for ( auto& i : data ) { i.nDisposeCount = 0; - ASSERT_TRUE( s.insert( i ) ); + ASSERT_TRUE( s.insert( i )); } // get/extract @@ -89,7 +89,7 @@ namespace cds_test { auto& i = data[idx]; EXPECT_EQ( i.nFindCount, 0u ); - gp = s.get( i.key() ); + gp = s.get( i.key()); ASSERT_FALSE( !gp ); ++gp->nFindCount; EXPECT_EQ( i.nFindCount, 1u ); @@ -99,15 +99,15 @@ namespace cds_test { ++gp->nEraseCount; EXPECT_EQ( i.nEraseCount, 1u ); - gp = s.extract( i.key() ); + gp = s.extract( i.key()); ASSERT_TRUE( !gp ); - gp = s.get( i.key() ); + gp = s.get( i.key()); ASSERT_TRUE( !gp ); } gp.release(); - ASSERT_TRUE( s.empty() ); + ASSERT_TRUE( s.empty()); ASSERT_CONTAINER_SIZE( s, 0 ); // Force retiring cycle @@ -119,16 +119,16 @@ namespace cds_test { // erase_at( iterator ) for ( auto& i : data ) { i.clear_stat(); - ASSERT_TRUE( s.insert( i ) ); + ASSERT_TRUE( s.insert( i )); } - ASSERT_FALSE( s.empty() ); + ASSERT_FALSE( s.empty()); ASSERT_CONTAINER_SIZE( s, nSetSize ); for ( auto it = s.begin(); it != s.end(); ++it ) { - ASSERT_TRUE( s.erase_at( it ) ); - ASSERT_FALSE( s.erase_at( it ) ); + ASSERT_TRUE( s.erase_at( it )); + ASSERT_FALSE( s.erase_at( it )); } - ASSERT_TRUE( s.empty() ); + ASSERT_TRUE( s.empty()); ASSERT_CONTAINER_SIZE( s, 0 ); // Force retiring cycle @@ -140,16 +140,16 @@ namespace cds_test { // erase_at( reverse_iterator ) for ( auto& i : data ) { i.clear_stat(); - ASSERT_TRUE( s.insert( i ) ); + ASSERT_TRUE( s.insert( i )); } - ASSERT_FALSE( s.empty() ); + ASSERT_FALSE( s.empty()); ASSERT_CONTAINER_SIZE( s, nSetSize ); for ( auto it = s.rbegin(); it != s.rend(); ++it ) { - ASSERT_TRUE( s.erase_at( it ) ); - ASSERT_FALSE( s.erase_at( it ) ); + ASSERT_TRUE( s.erase_at( it )); + ASSERT_FALSE( s.erase_at( it )); } - ASSERT_TRUE( s.empty() ); + ASSERT_TRUE( s.empty()); ASSERT_CONTAINER_SIZE( s, 0 ); // Force retiring cycle diff --git a/test/unit/intrusive-set/test_intrusive_feldman_hashset_rcu.h b/test/unit/intrusive-set/test_intrusive_feldman_hashset_rcu.h index d7af35ca..d8f795d5 100644 --- a/test/unit/intrusive-set/test_intrusive_feldman_hashset_rcu.h +++ b/test/unit/intrusive-set/test_intrusive_feldman_hashset_rcu.h @@ -54,21 +54,21 @@ protected: base_class::test( s ); - ASSERT_TRUE( s.empty() ); + ASSERT_TRUE( s.empty()); ASSERT_CONTAINER_SIZE( s, 0 ); typedef typename Set::value_type value_type; - size_t const nSetSize = std::max( s.head_size() * 2, static_cast(100) ); + size_t const nSetSize = std::max( s.head_size() * 2, static_cast(100)); std::vector< value_type > data; std::vector< size_t> indices; data.reserve( nSetSize ); indices.reserve( nSetSize ); for ( size_t key = 0; key < nSetSize; ++key ) { - data.push_back( value_type( static_cast(key) ) ); + data.push_back( value_type( static_cast(key)) ); indices.push_back( key ); } - shuffle( indices.begin(), indices.end() ); + shuffle( indices.begin(), indices.end()); typename Set::exempt_ptr xp; value_type * rp; @@ -80,18 +80,18 @@ protected: { rcu_lock l; - rp = s.get( i.key() ); + rp = s.get( i.key()); ASSERT_TRUE( !rp ); } - xp = s.extract( i.key() ); + xp = s.extract( i.key()); ASSERT_TRUE( !xp ); } // fill set for ( auto& i : data ) { i.nDisposeCount = 0; - ASSERT_TRUE( s.insert( i ) ); + ASSERT_TRUE( s.insert( i )); } // get/extract @@ -101,7 +101,7 @@ protected: { rcu_lock l; EXPECT_EQ( i.nFindCount, 0u ); - rp = s.get( i.key() ); + rp = s.get( i.key()); ASSERT_FALSE( !rp ); ++rp->nFindCount; EXPECT_EQ( i.nFindCount, 1u ); @@ -113,11 +113,11 @@ protected: ++xp->nEraseCount; EXPECT_EQ( i.nEraseCount, 1u ); - xp = s.extract( i.key() ); + xp = s.extract( i.key()); ASSERT_TRUE( !xp ); } - ASSERT_TRUE( s.empty() ); + ASSERT_TRUE( s.empty()); ASSERT_CONTAINER_SIZE( s, 0 ); // Force retiring cycle diff --git a/test/unit/intrusive-set/test_intrusive_michael_iterable.h b/test/unit/intrusive-set/test_intrusive_michael_iterable.h index aa47b6ef..3af0cbe5 100644 --- a/test/unit/intrusive-set/test_intrusive_michael_iterable.h +++ b/test/unit/intrusive-set/test_intrusive_michael_iterable.h @@ -65,7 +65,7 @@ namespace cds_test { void clear_stat() { - memset( this, 0, sizeof( *this ) ); + memset( this, 0, sizeof( *this )); } }; @@ -152,7 +152,7 @@ namespace cds_test { struct cmp { int operator ()(const T& v1, const T& v2 ) const { - if ( v1.key() < v2.key() ) + if ( v1.key() < v2.key()) return -1; return v1.key() > v2.key() ? 1 : 0; } @@ -168,7 +168,7 @@ namespace cds_test { template int operator ()(const Q& v1, const T& v2 ) const { - if ( v1 < v2.key() ) + if ( v1 < v2.key()) return -1; return v1 > v2.key() ? 1 : 0; } @@ -211,7 +211,7 @@ namespace cds_test { // Precondition: set is empty // Postcondition: set is empty - ASSERT_TRUE( s.empty() ); + ASSERT_TRUE( s.empty()); ASSERT_CONTAINER_SIZE( s, 0 ); size_t const nSetSize = kSize; @@ -225,7 +225,7 @@ namespace cds_test { data.push_back( value_type( static_cast( key ))); indices.push_back( key ); } - shuffle( indices.begin(), indices.end() ); + shuffle( indices.begin(), indices.end()); // insert/find for ( auto idx : indices ) { @@ -237,7 +237,7 @@ namespace cds_test { ASSERT_FALSE( s.find( i.nKey, []( value_type&, int ) {} )); ASSERT_FALSE( s.find_with( other_item( i.key()), other_less(), []( value_type&, other_item const& ) {} )); ASSERT_TRUE( s.find( i.nKey ) == s.end()); - ASSERT_TRUE( s.find_with( other_item( i.key() ), other_less()) == s.end()); + ASSERT_TRUE( s.find_with( other_item( i.key()), other_less()) == s.end()); std::pair updResult; @@ -259,7 +259,7 @@ namespace cds_test { updResult = s.update( i, []( value_type& val, value_type* arg) { ASSERT_TRUE( arg != nullptr ); - EXPECT_EQ( val.key(), arg->key() ); + EXPECT_EQ( val.key(), arg->key()); }, false ); EXPECT_TRUE( updResult.first ); EXPECT_FALSE( updResult.second ); @@ -268,7 +268,7 @@ namespace cds_test { EXPECT_EQ( i.nUpdateNewCount, 0u ); ASSERT_TRUE( s.insert( i, []( value_type& v ) { ++v.nUpdateNewCount;} )); EXPECT_EQ( i.nUpdateNewCount, 1u ); - ASSERT_FALSE( s.insert( i, []( value_type& v ) { ++v.nUpdateNewCount;} ) ); + ASSERT_FALSE( s.insert( i, []( value_type& v ) { ++v.nUpdateNewCount;} )); EXPECT_EQ( i.nUpdateNewCount, 1u ); i.nUpdateNewCount = 0; break; @@ -287,41 +287,41 @@ namespace cds_test { break; } - ASSERT_TRUE( s.contains( i.nKey ) ); - ASSERT_TRUE( s.contains( i ) ); - ASSERT_TRUE( s.contains( other_item( i.key() ), other_less())); + ASSERT_TRUE( s.contains( i.nKey )); + ASSERT_TRUE( s.contains( i )); + ASSERT_TRUE( s.contains( other_item( i.key()), other_less())); EXPECT_EQ( i.nFindCount, 0u ); ASSERT_TRUE( s.find( i.nKey, []( value_type& v, int ) { ++v.nFindCount; } )); EXPECT_EQ( i.nFindCount, 1u ); - ASSERT_TRUE( s.find_with( other_item( i.key() ), other_less(), []( value_type& v, other_item const& ) { ++v.nFindCount; } )); + ASSERT_TRUE( s.find_with( other_item( i.key()), other_less(), []( value_type& v, other_item const& ) { ++v.nFindCount; } )); EXPECT_EQ( i.nFindCount, 2u ); - ASSERT_TRUE( s.find( i.nKey ) != s.end() ); - ASSERT_TRUE( s.find_with( other_item( i.key() ), other_less() ) != s.end() ); - EXPECT_EQ( s.find( i.nKey )->nKey, i.key() ); - EXPECT_EQ( s.find_with( other_item( i.key() ), other_less())->nKey, i.key() ); + ASSERT_TRUE( s.find( i.nKey ) != s.end()); + ASSERT_TRUE( s.find_with( other_item( i.key()), other_less()) != s.end()); + EXPECT_EQ( s.find( i.nKey )->nKey, i.key()); + EXPECT_EQ( s.find_with( other_item( i.key()), other_less())->nKey, i.key()); } - ASSERT_FALSE( s.empty() ); + ASSERT_FALSE( s.empty()); ASSERT_CONTAINER_SIZE( s, nSetSize ); std::for_each( data.begin(), data.end(), []( value_type& v ) { v.clear_stat(); }); // erase - shuffle( indices.begin(), indices.end() ); + shuffle( indices.begin(), indices.end()); for ( auto idx : indices ) { auto& i = data[ idx ]; - ASSERT_TRUE( s.contains( i.nKey ) ); - ASSERT_TRUE( s.contains( i ) ); - ASSERT_TRUE( s.contains( other_item( i.key() ), other_less() ) ); + ASSERT_TRUE( s.contains( i.nKey )); + ASSERT_TRUE( s.contains( i )); + ASSERT_TRUE( s.contains( other_item( i.key()), other_less()) ); EXPECT_EQ( i.nFindCount, 0u ); - ASSERT_TRUE( s.find( i.nKey, []( value_type& v, int ) { ++v.nFindCount; } ) ); + ASSERT_TRUE( s.find( i.nKey, []( value_type& v, int ) { ++v.nFindCount; } )); EXPECT_EQ( i.nFindCount, 1u ); - ASSERT_TRUE( s.find_with( other_item( i.key() ), other_less(), []( value_type& v, other_item const& ) { ++v.nFindCount; } ) ); + ASSERT_TRUE( s.find_with( other_item( i.key()), other_less(), []( value_type& v, other_item const& ) { ++v.nFindCount; } )); EXPECT_EQ( i.nFindCount, 2u ); - ASSERT_TRUE( s.find( i.nKey ) != s.end() ); - ASSERT_TRUE( s.find_with( other_item( i.key() ), other_less()) != s.end() ); - EXPECT_EQ( s.find( i.nKey )->nKey, i.key() ); - EXPECT_EQ( s.find_with( other_item( i.key() ), other_less())->nKey, i.key() ); + ASSERT_TRUE( s.find( i.nKey ) != s.end()); + ASSERT_TRUE( s.find_with( other_item( i.key()), other_less()) != s.end()); + EXPECT_EQ( s.find( i.nKey )->nKey, i.key()); + EXPECT_EQ( s.find_with( other_item( i.key()), other_less())->nKey, i.key()); value_type v( i ); @@ -329,19 +329,19 @@ namespace cds_test { case 0: ASSERT_FALSE( s.unlink( v )); ASSERT_TRUE( s.unlink( i )); - ASSERT_FALSE( s.unlink( i ) ); + ASSERT_FALSE( s.unlink( i )); break; case 1: ASSERT_TRUE( s.erase( i.key())); - ASSERT_FALSE( s.erase( i.key() ) ); + ASSERT_FALSE( s.erase( i.key()) ); break; case 2: ASSERT_TRUE( s.erase( v )); - ASSERT_FALSE( s.erase( v ) ); + ASSERT_FALSE( s.erase( v )); break; case 3: ASSERT_TRUE( s.erase_with( other_item( i.key()), other_less())); - ASSERT_FALSE( s.erase_with( other_item( i.key() ), other_less() ) ); + ASSERT_FALSE( s.erase_with( other_item( i.key()), other_less()) ); break; case 4: EXPECT_EQ( i.nEraseCount, 0u ); @@ -352,9 +352,9 @@ namespace cds_test { break; case 5: EXPECT_EQ( i.nEraseCount, 0u ); - ASSERT_TRUE( s.erase_with( other_item( i.key() ), other_less(), []( value_type& val ) { ++val.nEraseCount; } )); + ASSERT_TRUE( s.erase_with( other_item( i.key()), other_less(), []( value_type& val ) { ++val.nEraseCount; } )); EXPECT_EQ( i.nEraseCount, 1u ); - ASSERT_FALSE( s.erase_with( other_item( i.key() ), other_less(), []( value_type& val ) { ++val.nEraseCount; } )); + ASSERT_FALSE( s.erase_with( other_item( i.key()), other_less(), []( value_type& val ) { ++val.nEraseCount; } )); EXPECT_EQ( i.nEraseCount, 1u ); break; } @@ -364,10 +364,10 @@ namespace cds_test { ASSERT_FALSE( s.contains( other_item( i.key()), other_less())); ASSERT_FALSE( s.find( i.nKey, []( value_type&, int ) {} )); ASSERT_FALSE( s.find_with( other_item( i.key()), other_less(), []( value_type&, other_item const& ) {} )); - ASSERT_TRUE( s.find( i.nKey ) == s.end() ); - ASSERT_TRUE( s.find_with( other_item( i.key() ), other_less() ) == s.end() ); + ASSERT_TRUE( s.find( i.nKey ) == s.end()); + ASSERT_TRUE( s.find_with( other_item( i.key()), other_less()) == s.end()); } - ASSERT_TRUE( s.empty() ); + ASSERT_TRUE( s.empty()); ASSERT_CONTAINER_SIZE( s, 0u ); // Force retiring cycle @@ -381,7 +381,7 @@ namespace cds_test { i.clear_stat(); ASSERT_TRUE( s.insert( i )); } - ASSERT_FALSE( s.empty() ); + ASSERT_FALSE( s.empty()); ASSERT_CONTAINER_SIZE( s, nSetSize ); // Iterator test @@ -400,8 +400,8 @@ namespace cds_test { ASSERT_TRUE( s.empty()); ASSERT_CONTAINER_SIZE( s, 0u ); - ASSERT_TRUE( s.begin() == s.end() ); - ASSERT_TRUE( s.cbegin() == s.cend() ); + ASSERT_TRUE( s.begin() == s.end()); + ASSERT_TRUE( s.cbegin() == s.cend()); // Force retiring cycle Set::gc::force_dispose(); diff --git a/test/unit/intrusive-set/test_intrusive_michael_iterable_hp.h b/test/unit/intrusive-set/test_intrusive_michael_iterable_hp.h index b6a36a47..cc644ab8 100644 --- a/test/unit/intrusive-set/test_intrusive_michael_iterable_hp.h +++ b/test/unit/intrusive-set/test_intrusive_michael_iterable_hp.h @@ -55,7 +55,7 @@ namespace cds_test { base_class::test( s ); - ASSERT_TRUE( s.empty() ); + ASSERT_TRUE( s.empty()); ASSERT_CONTAINER_SIZE( s, 0 ); typedef typename Set::value_type value_type; @@ -65,10 +65,10 @@ namespace cds_test { data.reserve( kSize ); indices.reserve( kSize ); for ( size_t key = 0; key < kSize; ++key ) { - data.push_back( value_type( static_cast(key) ) ); + data.push_back( value_type( static_cast(key)) ); indices.push_back( key ); } - shuffle( indices.begin(), indices.end() ); + shuffle( indices.begin(), indices.end()); typename Set::guarded_ptr gp; @@ -78,7 +78,7 @@ namespace cds_test { gp = s.get( i ); ASSERT_TRUE( !gp ); - gp = s.get( i.key() ); + gp = s.get( i.key()); ASSERT_TRUE( !gp ); gp = s.get_with( other_item( i.key()), other_less()); ASSERT_TRUE( !gp ); @@ -94,7 +94,7 @@ namespace cds_test { // fill set for ( auto& i : data ) { i.nDisposeCount = 0; - ASSERT_TRUE( s.insert( i ) ); + ASSERT_TRUE( s.insert( i )); } // get/extract @@ -107,7 +107,7 @@ namespace cds_test { ++gp->nFindCount; EXPECT_EQ( i.nFindCount, 1u ); - gp = s.get( i.key() ); + gp = s.get( i.key()); ASSERT_FALSE( !gp ); ++gp->nFindCount; EXPECT_EQ( i.nFindCount, 2u ); @@ -126,7 +126,7 @@ namespace cds_test { gp = s.extract( i ); break; case 2: - gp = s.extract_with( other_item( i.key() ), other_less() ); + gp = s.extract_with( other_item( i.key()), other_less()); break; } ASSERT_FALSE( !gp ); @@ -135,15 +135,15 @@ namespace cds_test { gp = s.extract( i ); ASSERT_TRUE( !gp ); - gp = s.extract( i.key() ); + gp = s.extract( i.key()); ASSERT_TRUE( !gp ); - gp = s.extract_with( other_item( i.key() ), other_less() ); + gp = s.extract_with( other_item( i.key()), other_less()); ASSERT_TRUE( !gp ); } gp.release(); - ASSERT_TRUE( s.empty() ); + ASSERT_TRUE( s.empty()); ASSERT_CONTAINER_SIZE( s, 0 ); // Force retiring cycle diff --git a/test/unit/intrusive-set/test_intrusive_set.h b/test/unit/intrusive-set/test_intrusive_set.h index 06114b8e..b99e1fee 100644 --- a/test/unit/intrusive-set/test_intrusive_set.h +++ b/test/unit/intrusive-set/test_intrusive_set.h @@ -65,7 +65,7 @@ namespace cds_test { void clear_stat() { - memset( this, 0, sizeof( *this ) ); + memset( this, 0, sizeof( *this )); } }; @@ -147,7 +147,7 @@ namespace cds_test { template size_t operator()( const Item& i ) const { - return (*this)( i.key() ); + return (*this)( i.key()); } }; @@ -206,7 +206,7 @@ namespace cds_test { struct cmp { int operator ()(const T& v1, const T& v2 ) const { - if ( v1.key() < v2.key() ) + if ( v1.key() < v2.key()) return -1; return v1.key() > v2.key() ? 1 : 0; } @@ -222,7 +222,7 @@ namespace cds_test { template int operator ()(const Q& v1, const T& v2 ) const { - if ( v1 < v2.key() ) + if ( v1 < v2.key()) return -1; return v1 > v2.key() ? 1 : 0; } @@ -265,7 +265,7 @@ namespace cds_test { // Precondition: set is empty // Postcondition: set is empty - ASSERT_TRUE( s.empty() ); + ASSERT_TRUE( s.empty()); ASSERT_CONTAINER_SIZE( s, 0 ); size_t const nSetSize = kSize; @@ -279,7 +279,7 @@ namespace cds_test { data.push_back( value_type( static_cast( key ))); indices.push_back( key ); } - shuffle( indices.begin(), indices.end() ); + shuffle( indices.begin(), indices.end()); // insert/find for ( auto idx : indices ) { @@ -316,7 +316,7 @@ namespace cds_test { EXPECT_EQ( i.nUpdateNewCount, 0u ); ASSERT_TRUE( s.insert( i, []( value_type& v ) { ++v.nUpdateNewCount;} )); EXPECT_EQ( i.nUpdateNewCount, 1u ); - ASSERT_FALSE( s.insert( i, []( value_type& v ) { ++v.nUpdateNewCount;} ) ); + ASSERT_FALSE( s.insert( i, []( value_type& v ) { ++v.nUpdateNewCount;} )); EXPECT_EQ( i.nUpdateNewCount, 1u ); i.nUpdateNewCount = 0; break; @@ -331,32 +331,32 @@ namespace cds_test { break; } - ASSERT_TRUE( s.contains( i.nKey ) ); - ASSERT_TRUE( s.contains( i ) ); - ASSERT_TRUE( s.contains( other_item( i.key() ), other_less())); + ASSERT_TRUE( s.contains( i.nKey )); + ASSERT_TRUE( s.contains( i )); + ASSERT_TRUE( s.contains( other_item( i.key()), other_less())); EXPECT_EQ( i.nFindCount, 0u ); ASSERT_TRUE( s.find( i.nKey, []( value_type& v, int ) { ++v.nFindCount; } )); EXPECT_EQ( i.nFindCount, 1u ); - ASSERT_TRUE( s.find_with( other_item( i.key() ), other_less(), []( value_type& v, other_item const& ) { ++v.nFindCount; } )); + ASSERT_TRUE( s.find_with( other_item( i.key()), other_less(), []( value_type& v, other_item const& ) { ++v.nFindCount; } )); EXPECT_EQ( i.nFindCount, 2u ); } - ASSERT_FALSE( s.empty() ); + ASSERT_FALSE( s.empty()); ASSERT_CONTAINER_SIZE( s, nSetSize ); std::for_each( data.begin(), data.end(), []( value_type& v ) { v.clear_stat(); }); // erase - shuffle( indices.begin(), indices.end() ); + shuffle( indices.begin(), indices.end()); for ( auto idx : indices ) { auto& i = data[ idx ]; - ASSERT_TRUE( s.contains( i.nKey ) ); - ASSERT_TRUE( s.contains( i ) ); - ASSERT_TRUE( s.contains( other_item( i.key() ), other_less() ) ); + ASSERT_TRUE( s.contains( i.nKey )); + ASSERT_TRUE( s.contains( i )); + ASSERT_TRUE( s.contains( other_item( i.key()), other_less()) ); EXPECT_EQ( i.nFindCount, 0u ); - ASSERT_TRUE( s.find( i.nKey, []( value_type& v, int ) { ++v.nFindCount; } ) ); + ASSERT_TRUE( s.find( i.nKey, []( value_type& v, int ) { ++v.nFindCount; } )); EXPECT_EQ( i.nFindCount, 1u ); - ASSERT_TRUE( s.find_with( other_item( i.key() ), other_less(), []( value_type& v, other_item const& ) { ++v.nFindCount; } ) ); + ASSERT_TRUE( s.find_with( other_item( i.key()), other_less(), []( value_type& v, other_item const& ) { ++v.nFindCount; } )); EXPECT_EQ( i.nFindCount, 2u ); value_type v( i ); @@ -364,19 +364,19 @@ namespace cds_test { case 0: ASSERT_FALSE( s.unlink( v )); ASSERT_TRUE( s.unlink( i )); - ASSERT_FALSE( s.unlink( i ) ); + ASSERT_FALSE( s.unlink( i )); break; case 1: ASSERT_TRUE( s.erase( i.key())); - ASSERT_FALSE( s.erase( i.key() ) ); + ASSERT_FALSE( s.erase( i.key()) ); break; case 2: ASSERT_TRUE( s.erase( v )); - ASSERT_FALSE( s.erase( v ) ); + ASSERT_FALSE( s.erase( v )); break; case 3: ASSERT_TRUE( s.erase_with( other_item( i.key()), other_less())); - ASSERT_FALSE( s.erase_with( other_item( i.key() ), other_less() ) ); + ASSERT_FALSE( s.erase_with( other_item( i.key()), other_less()) ); break; case 4: EXPECT_EQ( i.nEraseCount, 0u ); @@ -387,9 +387,9 @@ namespace cds_test { break; case 5: EXPECT_EQ( i.nEraseCount, 0u ); - ASSERT_TRUE( s.erase_with( other_item( i.key() ), other_less(), []( value_type& val ) { ++val.nEraseCount; } )); + ASSERT_TRUE( s.erase_with( other_item( i.key()), other_less(), []( value_type& val ) { ++val.nEraseCount; } )); EXPECT_EQ( i.nEraseCount, 1u ); - ASSERT_FALSE( s.erase_with( other_item( i.key() ), other_less(), []( value_type& val ) { ++val.nEraseCount; } )); + ASSERT_FALSE( s.erase_with( other_item( i.key()), other_less(), []( value_type& val ) { ++val.nEraseCount; } )); EXPECT_EQ( i.nEraseCount, 1u ); break; } @@ -400,7 +400,7 @@ namespace cds_test { ASSERT_FALSE( s.find( i.nKey, []( value_type&, int ) {} )); ASSERT_FALSE( s.find_with( other_item( i.key()), other_less(), []( value_type&, other_item const& ) {} )); } - ASSERT_TRUE( s.empty() ); + ASSERT_TRUE( s.empty()); ASSERT_CONTAINER_SIZE( s, 0u ); // Force retiring cycle @@ -414,7 +414,7 @@ namespace cds_test { i.clear_stat(); ASSERT_TRUE( s.insert( i )); } - ASSERT_FALSE( s.empty() ); + ASSERT_FALSE( s.empty()); ASSERT_CONTAINER_SIZE( s, nSetSize ); // Iterator test @@ -433,8 +433,8 @@ namespace cds_test { ASSERT_TRUE( s.empty()); ASSERT_CONTAINER_SIZE( s, 0u ); - ASSERT_TRUE( s.begin() == s.end() ); - ASSERT_TRUE( s.cbegin() == s.cend() ); + ASSERT_TRUE( s.begin() == s.end()); + ASSERT_TRUE( s.cbegin() == s.cend()); // Force retiring cycle Set::gc::force_dispose(); diff --git a/test/unit/intrusive-set/test_intrusive_set_hp.h b/test/unit/intrusive-set/test_intrusive_set_hp.h index 29eb9442..90746509 100644 --- a/test/unit/intrusive-set/test_intrusive_set_hp.h +++ b/test/unit/intrusive-set/test_intrusive_set_hp.h @@ -55,7 +55,7 @@ namespace cds_test { base_class::test( s ); - ASSERT_TRUE( s.empty() ); + ASSERT_TRUE( s.empty()); ASSERT_CONTAINER_SIZE( s, 0 ); typedef typename Set::value_type value_type; @@ -65,10 +65,10 @@ namespace cds_test { data.reserve( kSize ); indices.reserve( kSize ); for ( size_t key = 0; key < kSize; ++key ) { - data.push_back( value_type( static_cast(key) ) ); + data.push_back( value_type( static_cast(key)) ); indices.push_back( key ); } - shuffle( indices.begin(), indices.end() ); + shuffle( indices.begin(), indices.end()); typename Set::guarded_ptr gp; @@ -78,7 +78,7 @@ namespace cds_test { gp = s.get( i ); ASSERT_TRUE( !gp ); - gp = s.get( i.key() ); + gp = s.get( i.key()); ASSERT_TRUE( !gp ); gp = s.get_with( other_item( i.key()), other_less()); ASSERT_TRUE( !gp ); @@ -94,7 +94,7 @@ namespace cds_test { // fill set for ( auto& i : data ) { i.nDisposeCount = 0; - ASSERT_TRUE( s.insert( i ) ); + ASSERT_TRUE( s.insert( i )); } // get/extract @@ -107,7 +107,7 @@ namespace cds_test { ++gp->nFindCount; EXPECT_EQ( i.nFindCount, 1u ); - gp = s.get( i.key() ); + gp = s.get( i.key()); ASSERT_FALSE( !gp ); ++gp->nFindCount; EXPECT_EQ( i.nFindCount, 2u ); @@ -126,7 +126,7 @@ namespace cds_test { gp = s.extract( i ); break; case 2: - gp = s.extract_with( other_item( i.key() ), other_less() ); + gp = s.extract_with( other_item( i.key()), other_less()); break; } ASSERT_FALSE( !gp ); @@ -135,15 +135,15 @@ namespace cds_test { gp = s.extract( i ); ASSERT_TRUE( !gp ); - gp = s.extract( i.key() ); + gp = s.extract( i.key()); ASSERT_TRUE( !gp ); - gp = s.extract_with( other_item( i.key() ), other_less() ); + gp = s.extract_with( other_item( i.key()), other_less()); ASSERT_TRUE( !gp ); } gp.release(); - ASSERT_TRUE( s.empty() ); + ASSERT_TRUE( s.empty()); ASSERT_CONTAINER_SIZE( s, 0u ); // Force retiring cycle diff --git a/test/unit/intrusive-set/test_intrusive_set_nogc.h b/test/unit/intrusive-set/test_intrusive_set_nogc.h index 74f6d046..7782d0b5 100644 --- a/test/unit/intrusive-set/test_intrusive_set_nogc.h +++ b/test/unit/intrusive-set/test_intrusive_set_nogc.h @@ -64,7 +64,7 @@ namespace cds_test { void clear_stat() { - memset( this, 0, sizeof( *this ) ); + memset( this, 0, sizeof( *this )); } }; @@ -146,7 +146,7 @@ namespace cds_test { template size_t operator()( const Item& i ) const { - return (*this)( i.key() ); + return (*this)( i.key()); } }; @@ -205,7 +205,7 @@ namespace cds_test { struct cmp { int operator ()(const T& v1, const T& v2 ) const { - if ( v1.key() < v2.key() ) + if ( v1.key() < v2.key()) return -1; return v1.key() > v2.key() ? 1 : 0; } @@ -221,7 +221,7 @@ namespace cds_test { template int operator ()(const Q& v1, const T& v2 ) const { - if ( v1 < v2.key() ) + if ( v1 < v2.key()) return -1; return v1 > v2.key() ? 1 : 0; } @@ -264,7 +264,7 @@ namespace cds_test { // Precondition: set is empty // Postcondition: set is empty - ASSERT_TRUE( s.empty() ); + ASSERT_TRUE( s.empty()); ASSERT_CONTAINER_SIZE( s, 0 ); size_t const nSetSize = kSize; @@ -278,7 +278,7 @@ namespace cds_test { data.push_back( value_type( static_cast( key ))); indices.push_back( key ); } - shuffle( indices.begin(), indices.end() ); + shuffle( indices.begin(), indices.end()); // insert/find for ( auto idx : indices ) { @@ -330,14 +330,14 @@ namespace cds_test { ASSERT_TRUE( s.contains( i.nKey ) == &i ); ASSERT_TRUE( s.contains( i ) == &i ); - ASSERT_TRUE( s.contains( other_item( i.key() ), other_less()) == &i ); + ASSERT_TRUE( s.contains( other_item( i.key()), other_less()) == &i ); EXPECT_EQ( i.nFindCount, 0u ); ASSERT_TRUE( s.find( i.nKey, []( value_type& v, int ) { ++v.nFindCount; } )); EXPECT_EQ( i.nFindCount, 1u ); - ASSERT_TRUE( s.find_with( other_item( i.key() ), other_less(), []( value_type& v, other_item const& ) { ++v.nFindCount; } )); + ASSERT_TRUE( s.find_with( other_item( i.key()), other_less(), []( value_type& v, other_item const& ) { ++v.nFindCount; } )); EXPECT_EQ( i.nFindCount, 2u ); } - ASSERT_FALSE( s.empty() ); + ASSERT_FALSE( s.empty()); ASSERT_CONTAINER_SIZE( s, nSetSize ); std::for_each( data.begin(), data.end(), []( value_type& v ) { v.clear_stat(); }); @@ -364,8 +364,8 @@ namespace cds_test { ASSERT_TRUE( s.empty()); ASSERT_CONTAINER_SIZE( s, 0u ); - ASSERT_TRUE( s.begin() == s.end() ); - ASSERT_TRUE( s.cbegin() == s.cend() ); + ASSERT_TRUE( s.begin() == s.end()); + ASSERT_TRUE( s.cbegin() == s.cend()); } }; diff --git a/test/unit/intrusive-set/test_intrusive_set_rcu.h b/test/unit/intrusive-set/test_intrusive_set_rcu.h index c82e5741..bef48af8 100644 --- a/test/unit/intrusive-set/test_intrusive_set_rcu.h +++ b/test/unit/intrusive-set/test_intrusive_set_rcu.h @@ -55,7 +55,7 @@ namespace cds_test { base_class::test( s ); - ASSERT_TRUE( s.empty() ); + ASSERT_TRUE( s.empty()); ASSERT_CONTAINER_SIZE( s, 0 ); typedef typename Set::value_type value_type; @@ -65,10 +65,10 @@ namespace cds_test { data.reserve( kSize ); indices.reserve( kSize ); for ( size_t key = 0; key < kSize; ++key ) { - data.push_back( value_type( static_cast(key) ) ); + data.push_back( value_type( static_cast(key)) ); indices.push_back( key ); } - shuffle( indices.begin(), indices.end() ); + shuffle( indices.begin(), indices.end()); typename Set::exempt_ptr xp; typename Set::raw_ptr rp; @@ -82,7 +82,7 @@ namespace cds_test { rcu_lock l; rp = s.get( i ); ASSERT_TRUE( !rp ); - rp = s.get( i.key() ); + rp = s.get( i.key()); ASSERT_TRUE( !rp ); rp = s.get_with( other_item( i.key()), other_less()); ASSERT_TRUE( !rp ); @@ -93,17 +93,17 @@ namespace cds_test { xp = s.extract( i ); ASSERT_TRUE( !xp ); - xp = s.extract( i.key() ); + xp = s.extract( i.key()); ASSERT_TRUE( !xp ); - xp = s.extract_with( other_item( i.key() ), other_less() ); + xp = s.extract_with( other_item( i.key()), other_less()); ASSERT_TRUE( !xp ); } else { xp = s.extract( i ); ASSERT_TRUE( !xp ); - xp = s.extract( i.key() ); + xp = s.extract( i.key()); ASSERT_TRUE( !xp ); - xp = s.extract_with( other_item( i.key() ), other_less() ); + xp = s.extract_with( other_item( i.key()), other_less()); ASSERT_TRUE( !xp ); } } @@ -111,7 +111,7 @@ namespace cds_test { // fill set for ( auto& i : data ) { i.nDisposeCount = 0; - ASSERT_TRUE( s.insert( i ) ); + ASSERT_TRUE( s.insert( i )); } // get/extract @@ -126,7 +126,7 @@ namespace cds_test { ++rp->nFindCount; EXPECT_EQ( i.nFindCount, 1u ); - rp = s.get( i.key() ); + rp = s.get( i.key()); ASSERT_FALSE( !rp ); ++rp->nFindCount; EXPECT_EQ( i.nFindCount, 2u ); @@ -150,7 +150,7 @@ namespace cds_test { xp = s.extract( i ); break; case 2: - xp = s.extract_with( other_item( i.key() ), other_less() ); + xp = s.extract_with( other_item( i.key()), other_less()); break; } ASSERT_FALSE( !xp ); @@ -164,9 +164,9 @@ namespace cds_test { xp = s.extract( i ); ASSERT_TRUE( !xp ); - xp = s.extract( i.key() ); + xp = s.extract( i.key()); ASSERT_TRUE( !xp ); - xp = s.extract_with( other_item( i.key() ), other_less() ); + xp = s.extract_with( other_item( i.key()), other_less()); ASSERT_TRUE( !xp ); } } @@ -180,7 +180,7 @@ namespace cds_test { xp = s.extract( i ); break; case 2: - xp = s.extract_with( other_item( i.key() ), other_less() ); + xp = s.extract_with( other_item( i.key()), other_less()); break; } ASSERT_FALSE( !xp ); @@ -189,14 +189,14 @@ namespace cds_test { xp = s.extract( i ); ASSERT_TRUE( !xp ); - xp = s.extract( i.key() ); + xp = s.extract( i.key()); ASSERT_TRUE( !xp ); - xp = s.extract_with( other_item( i.key() ), other_less() ); + xp = s.extract_with( other_item( i.key()), other_less()); ASSERT_TRUE( !xp ); } } - ASSERT_TRUE( s.empty() ); + ASSERT_TRUE( s.empty()); ASSERT_CONTAINER_SIZE( s, 0 ); // Force retiring cycle diff --git a/test/unit/intrusive-set/test_intrusive_split_iterable_set.h b/test/unit/intrusive-set/test_intrusive_split_iterable_set.h index 9efbf915..2043306a 100644 --- a/test/unit/intrusive-set/test_intrusive_split_iterable_set.h +++ b/test/unit/intrusive-set/test_intrusive_split_iterable_set.h @@ -65,7 +65,7 @@ namespace cds_test { void clear_stat() { - memset( this, 0, sizeof( *this ) ); + memset( this, 0, sizeof( *this )); } }; @@ -153,7 +153,7 @@ namespace cds_test { struct cmp { int operator ()(const T& v1, const T& v2 ) const { - if ( v1.key() < v2.key() ) + if ( v1.key() < v2.key()) return -1; return v1.key() > v2.key() ? 1 : 0; } @@ -169,7 +169,7 @@ namespace cds_test { template int operator ()(const Q& v1, const T& v2 ) const { - if ( v1 < v2.key() ) + if ( v1 < v2.key()) return -1; return v1 > v2.key() ? 1 : 0; } @@ -212,7 +212,7 @@ namespace cds_test { // Precondition: set is empty // Postcondition: set is empty - ASSERT_TRUE( s.empty() ); + ASSERT_TRUE( s.empty()); ASSERT_CONTAINER_SIZE( s, 0 ); size_t const nSetSize = kSize; @@ -226,7 +226,7 @@ namespace cds_test { data.push_back( value_type( static_cast( key ))); indices.push_back( key ); } - shuffle( indices.begin(), indices.end() ); + shuffle( indices.begin(), indices.end()); // insert/find for ( auto idx : indices ) { @@ -238,7 +238,7 @@ namespace cds_test { ASSERT_FALSE( s.find( i.nKey, []( value_type&, int ) {} )); ASSERT_FALSE( s.find_with( other_item( i.key()), other_less(), []( value_type&, other_item const& ) {} )); ASSERT_TRUE( s.find( i.nKey ) == s.end()); - ASSERT_TRUE( s.find_with( other_item( i.key() ), other_less()) == s.end()); + ASSERT_TRUE( s.find_with( other_item( i.key()), other_less()) == s.end()); std::pair updResult; @@ -260,7 +260,7 @@ namespace cds_test { updResult = s.update( i, []( value_type& val, value_type* arg) { ASSERT_TRUE( arg != nullptr ); - EXPECT_EQ( val.key(), arg->key() ); + EXPECT_EQ( val.key(), arg->key()); }, false ); EXPECT_TRUE( updResult.first ); EXPECT_FALSE( updResult.second ); @@ -269,7 +269,7 @@ namespace cds_test { EXPECT_EQ( i.nUpdateNewCount, 0u ); ASSERT_TRUE( s.insert( i, []( value_type& v ) { ++v.nUpdateNewCount;} )); EXPECT_EQ( i.nUpdateNewCount, 1u ); - ASSERT_FALSE( s.insert( i, []( value_type& v ) { ++v.nUpdateNewCount;} ) ); + ASSERT_FALSE( s.insert( i, []( value_type& v ) { ++v.nUpdateNewCount;} )); EXPECT_EQ( i.nUpdateNewCount, 1u ); i.nUpdateNewCount = 0; break; @@ -288,41 +288,41 @@ namespace cds_test { break; } - ASSERT_TRUE( s.contains( i.nKey ) ); - ASSERT_TRUE( s.contains( i ) ); - ASSERT_TRUE( s.contains( other_item( i.key() ), other_less())); + ASSERT_TRUE( s.contains( i.nKey )); + ASSERT_TRUE( s.contains( i )); + ASSERT_TRUE( s.contains( other_item( i.key()), other_less())); EXPECT_EQ( i.nFindCount, 0u ); ASSERT_TRUE( s.find( i.nKey, []( value_type& v, int ) { ++v.nFindCount; } )); EXPECT_EQ( i.nFindCount, 1u ); - ASSERT_TRUE( s.find_with( other_item( i.key() ), other_less(), []( value_type& v, other_item const& ) { ++v.nFindCount; } )); + ASSERT_TRUE( s.find_with( other_item( i.key()), other_less(), []( value_type& v, other_item const& ) { ++v.nFindCount; } )); EXPECT_EQ( i.nFindCount, 2u ); - ASSERT_TRUE( s.find( i.nKey ) != s.end() ); - ASSERT_TRUE( s.find_with( other_item( i.key() ), other_less() ) != s.end() ); - EXPECT_EQ( s.find( i.nKey )->nKey, i.key() ); - EXPECT_EQ( s.find_with( other_item( i.key() ), other_less())->nKey, i.key() ); + ASSERT_TRUE( s.find( i.nKey ) != s.end()); + ASSERT_TRUE( s.find_with( other_item( i.key()), other_less()) != s.end()); + EXPECT_EQ( s.find( i.nKey )->nKey, i.key()); + EXPECT_EQ( s.find_with( other_item( i.key()), other_less())->nKey, i.key()); } - ASSERT_FALSE( s.empty() ); + ASSERT_FALSE( s.empty()); ASSERT_CONTAINER_SIZE( s, nSetSize ); std::for_each( data.begin(), data.end(), []( value_type& v ) { v.clear_stat(); }); // erase - shuffle( indices.begin(), indices.end() ); + shuffle( indices.begin(), indices.end()); for ( auto idx : indices ) { auto& i = data[ idx ]; - ASSERT_TRUE( s.contains( i.nKey ) ); - ASSERT_TRUE( s.contains( i ) ); - ASSERT_TRUE( s.contains( other_item( i.key() ), other_less() ) ); + ASSERT_TRUE( s.contains( i.nKey )); + ASSERT_TRUE( s.contains( i )); + ASSERT_TRUE( s.contains( other_item( i.key()), other_less()) ); EXPECT_EQ( i.nFindCount, 0u ); - ASSERT_TRUE( s.find( i.nKey, []( value_type& v, int ) { ++v.nFindCount; } ) ); + ASSERT_TRUE( s.find( i.nKey, []( value_type& v, int ) { ++v.nFindCount; } )); EXPECT_EQ( i.nFindCount, 1u ); - ASSERT_TRUE( s.find_with( other_item( i.key() ), other_less(), []( value_type& v, other_item const& ) { ++v.nFindCount; } ) ); + ASSERT_TRUE( s.find_with( other_item( i.key()), other_less(), []( value_type& v, other_item const& ) { ++v.nFindCount; } )); EXPECT_EQ( i.nFindCount, 2u ); - ASSERT_TRUE( s.find( i.nKey ) != s.end() ); - ASSERT_TRUE( s.find_with( other_item( i.key() ), other_less()) != s.end() ); - EXPECT_EQ( s.find( i.nKey )->nKey, i.key() ); - EXPECT_EQ( s.find_with( other_item( i.key() ), other_less())->nKey, i.key() ); + ASSERT_TRUE( s.find( i.nKey ) != s.end()); + ASSERT_TRUE( s.find_with( other_item( i.key()), other_less()) != s.end()); + EXPECT_EQ( s.find( i.nKey )->nKey, i.key()); + EXPECT_EQ( s.find_with( other_item( i.key()), other_less())->nKey, i.key()); value_type v( i ); @@ -330,19 +330,19 @@ namespace cds_test { case 0: ASSERT_FALSE( s.unlink( v )); ASSERT_TRUE( s.unlink( i )); - ASSERT_FALSE( s.unlink( i ) ); + ASSERT_FALSE( s.unlink( i )); break; case 1: ASSERT_TRUE( s.erase( i.key())); - ASSERT_FALSE( s.erase( i.key() ) ); + ASSERT_FALSE( s.erase( i.key()) ); break; case 2: ASSERT_TRUE( s.erase( v )); - ASSERT_FALSE( s.erase( v ) ); + ASSERT_FALSE( s.erase( v )); break; case 3: ASSERT_TRUE( s.erase_with( other_item( i.key()), other_less())); - ASSERT_FALSE( s.erase_with( other_item( i.key() ), other_less() ) ); + ASSERT_FALSE( s.erase_with( other_item( i.key()), other_less()) ); break; case 4: EXPECT_EQ( i.nEraseCount, 0u ); @@ -353,9 +353,9 @@ namespace cds_test { break; case 5: EXPECT_EQ( i.nEraseCount, 0u ); - ASSERT_TRUE( s.erase_with( other_item( i.key() ), other_less(), []( value_type& val ) { ++val.nEraseCount; } )); + ASSERT_TRUE( s.erase_with( other_item( i.key()), other_less(), []( value_type& val ) { ++val.nEraseCount; } )); EXPECT_EQ( i.nEraseCount, 1u ); - ASSERT_FALSE( s.erase_with( other_item( i.key() ), other_less(), []( value_type& val ) { ++val.nEraseCount; } )); + ASSERT_FALSE( s.erase_with( other_item( i.key()), other_less(), []( value_type& val ) { ++val.nEraseCount; } )); EXPECT_EQ( i.nEraseCount, 1u ); break; } @@ -365,10 +365,10 @@ namespace cds_test { ASSERT_FALSE( s.contains( other_item( i.key()), other_less())); ASSERT_FALSE( s.find( i.nKey, []( value_type&, int ) {} )); ASSERT_FALSE( s.find_with( other_item( i.key()), other_less(), []( value_type&, other_item const& ) {} )); - ASSERT_TRUE( s.find( i.nKey ) == s.end() ); - ASSERT_TRUE( s.find_with( other_item( i.key() ), other_less() ) == s.end() ); + ASSERT_TRUE( s.find( i.nKey ) == s.end()); + ASSERT_TRUE( s.find_with( other_item( i.key()), other_less()) == s.end()); } - ASSERT_TRUE( s.empty() ); + ASSERT_TRUE( s.empty()); ASSERT_CONTAINER_SIZE( s, 0u ); // Force retiring cycle @@ -382,7 +382,7 @@ namespace cds_test { i.clear_stat(); ASSERT_TRUE( s.insert( i )); } - ASSERT_FALSE( s.empty() ); + ASSERT_FALSE( s.empty()); ASSERT_CONTAINER_SIZE( s, nSetSize ); // Iterator test @@ -401,8 +401,8 @@ namespace cds_test { ASSERT_TRUE( s.empty()); ASSERT_CONTAINER_SIZE( s, 0u ); - ASSERT_TRUE( s.begin() == s.end() ); - ASSERT_TRUE( s.cbegin() == s.cend() ); + ASSERT_TRUE( s.begin() == s.end()); + ASSERT_TRUE( s.cbegin() == s.cend()); // Force retiring cycle Set::gc::force_dispose(); diff --git a/test/unit/intrusive-set/test_intrusive_split_iterable_set_hp.h b/test/unit/intrusive-set/test_intrusive_split_iterable_set_hp.h index 05a5b7c2..1d634f30 100644 --- a/test/unit/intrusive-set/test_intrusive_split_iterable_set_hp.h +++ b/test/unit/intrusive-set/test_intrusive_split_iterable_set_hp.h @@ -55,7 +55,7 @@ namespace cds_test { base_class::test( s ); - ASSERT_TRUE( s.empty() ); + ASSERT_TRUE( s.empty()); ASSERT_CONTAINER_SIZE( s, 0 ); typedef typename Set::value_type value_type; @@ -65,10 +65,10 @@ namespace cds_test { data.reserve( kSize ); indices.reserve( kSize ); for ( size_t key = 0; key < kSize; ++key ) { - data.push_back( value_type( static_cast(key) ) ); + data.push_back( value_type( static_cast(key)) ); indices.push_back( key ); } - shuffle( indices.begin(), indices.end() ); + shuffle( indices.begin(), indices.end()); typename Set::guarded_ptr gp; @@ -78,7 +78,7 @@ namespace cds_test { gp = s.get( i ); ASSERT_TRUE( !gp ); - gp = s.get( i.key() ); + gp = s.get( i.key()); ASSERT_TRUE( !gp ); gp = s.get_with( other_item( i.key()), other_less()); ASSERT_TRUE( !gp ); @@ -94,7 +94,7 @@ namespace cds_test { // fill set for ( auto& i : data ) { i.nDisposeCount = 0; - ASSERT_TRUE( s.insert( i ) ); + ASSERT_TRUE( s.insert( i )); } // get/extract @@ -107,7 +107,7 @@ namespace cds_test { ++gp->nFindCount; EXPECT_EQ( i.nFindCount, 1u ); - gp = s.get( i.key() ); + gp = s.get( i.key()); ASSERT_FALSE( !gp ); ++gp->nFindCount; EXPECT_EQ( i.nFindCount, 2u ); @@ -126,7 +126,7 @@ namespace cds_test { gp = s.extract( i ); break; case 2: - gp = s.extract_with( other_item( i.key() ), other_less() ); + gp = s.extract_with( other_item( i.key()), other_less()); break; } ASSERT_FALSE( !gp ); @@ -135,15 +135,15 @@ namespace cds_test { gp = s.extract( i ); ASSERT_TRUE( !gp ); - gp = s.extract( i.key() ); + gp = s.extract( i.key()); ASSERT_TRUE( !gp ); - gp = s.extract_with( other_item( i.key() ), other_less() ); + gp = s.extract_with( other_item( i.key()), other_less()); ASSERT_TRUE( !gp ); } gp.release(); - ASSERT_TRUE( s.empty() ); + ASSERT_TRUE( s.empty()); ASSERT_CONTAINER_SIZE( s, 0 ); // Force retiring cycle diff --git a/test/unit/list/test_iterable_list.h b/test/unit/list/test_iterable_list.h index 498eeb43..e9e3e9c0 100644 --- a/test/unit/list/test_iterable_list.h +++ b/test/unit/list/test_iterable_list.h @@ -92,7 +92,7 @@ namespace cds_test { struct cmp { int operator ()( const T& v1, const T& v2 ) const { - if ( v1.key() < v2.key() ) + if ( v1.key() < v2.key()) return -1; return v1.key() > v2.key() ? 1 : 0; } @@ -108,7 +108,7 @@ namespace cds_test { template int operator ()( const Q& v1, const T& v2 ) const { - if ( v1 < v2.key() ) + if ( v1 < v2.key()) return -1; return v1 > v2.key() ? 1 : 0; } @@ -152,7 +152,7 @@ namespace cds_test { } shuffle( arr, arr + nSize ); - ASSERT_TRUE( l.empty() ); + ASSERT_TRUE( l.empty()); ASSERT_CONTAINER_SIZE( l, 0 ); // insert/find @@ -246,10 +246,10 @@ namespace cds_test { EXPECT_EQ( key.nKey, n.nKey ); EXPECT_EQ( n.nKey * 5, n.nVal ); } )); - ASSERT_FALSE( l.find( i ) == l.end() ); + ASSERT_FALSE( l.find( i ) == l.end()); EXPECT_EQ( l.find( i.nKey )->nKey, i.nKey ); - ASSERT_FALSE( l.find_with( other_item( i.nKey ), other_less() ) == l.end() ); - EXPECT_EQ( l.find_with( other_item( i.nKey ), other_less() )->nKey, i.nKey ); + ASSERT_FALSE( l.find_with( other_item( i.nKey ), other_less()) == l.end()); + EXPECT_EQ( l.find_with( other_item( i.nKey ), other_less())->nKey, i.nKey ); auto pair = l.upsert( i.nKey, false ); EXPECT_TRUE( pair.first ); @@ -264,18 +264,18 @@ namespace cds_test { EXPECT_TRUE( pair.first ); EXPECT_FALSE( pair.second ); - EXPECT_FALSE( l.empty() ); + EXPECT_FALSE( l.empty()); } - ASSERT_FALSE( l.empty() ); + ASSERT_FALSE( l.empty()); EXPECT_CONTAINER_SIZE( l, nSize ); // erase for ( auto const&i : arr ) { - ASSERT_FALSE( l.find( i.nKey ) == l.end() ); + ASSERT_FALSE( l.find( i.nKey ) == l.end()); EXPECT_EQ( l.find( i.nKey )->nKey, i.nKey ); - ASSERT_FALSE( l.find_with( other_item( i.nKey ), other_less() ) == l.end() ); - EXPECT_EQ( l.find_with( other_item( i.nKey ), other_less() )->nKey, i.nKey ); + ASSERT_FALSE( l.find_with( other_item( i.nKey ), other_less()) == l.end()); + EXPECT_EQ( l.find_with( other_item( i.nKey ), other_less())->nKey, i.nKey ); switch ( i.nKey % 4 ) { case 0: @@ -303,24 +303,24 @@ namespace cds_test { EXPECT_FALSE( l.find( i, []( value_type&, value_type const&) {} )); EXPECT_FALSE( l.find( i.nKey, []( value_type&, int ) {} )); EXPECT_FALSE( l.find_with( other_item( i.nKey ), other_less(), []( value_type&, other_item const& ) {} )); - EXPECT_TRUE( l.find( i ) == l.end() ); - EXPECT_TRUE( l.find( i.nKey ) == l.end() ); - EXPECT_TRUE( l.find_with( other_item( i.nKey ), other_less() ) == l.end() ); + EXPECT_TRUE( l.find( i ) == l.end()); + EXPECT_TRUE( l.find( i.nKey ) == l.end()); + EXPECT_TRUE( l.find_with( other_item( i.nKey ), other_less()) == l.end()); } - ASSERT_TRUE( l.empty() ); + ASSERT_TRUE( l.empty()); EXPECT_CONTAINER_SIZE( l, 0 ); // clear test for ( auto& i : arr ) EXPECT_TRUE( l.insert( i )); - ASSERT_FALSE( l.empty() ); + ASSERT_FALSE( l.empty()); EXPECT_CONTAINER_SIZE( l, nSize ); l.clear(); - ASSERT_TRUE( l.empty() ); + ASSERT_TRUE( l.empty()); EXPECT_CONTAINER_SIZE( l, 0 ); // empty list iterator test @@ -350,7 +350,7 @@ namespace cds_test { } shuffle( arr, arr + nSize ); - ASSERT_TRUE( l.empty() ); + ASSERT_TRUE( l.empty()); ASSERT_CONTAINER_SIZE( l, 0 ); for ( auto& i : arr ) @@ -395,7 +395,7 @@ namespace cds_test { EXPECT_EQ( static_cast(key), nSize ); l.clear(); - ASSERT_TRUE( l.empty() ); + ASSERT_TRUE( l.empty()); EXPECT_CONTAINER_SIZE( l, 0 ); } }; diff --git a/test/unit/list/test_iterable_list_hp.h b/test/unit/list/test_iterable_list_hp.h index a716d115..dde76085 100644 --- a/test/unit/list/test_iterable_list_hp.h +++ b/test/unit/list/test_iterable_list_hp.h @@ -55,7 +55,7 @@ namespace cds_test { } shuffle( arr, arr + nSize ); - ASSERT_TRUE( l.empty() ); + ASSERT_TRUE( l.empty()); ASSERT_CONTAINER_SIZE( l, 0 ); guarded_ptr gp; @@ -83,16 +83,16 @@ namespace cds_test { gp->nVal = gp->nKey * 10; ++nCount; - ASSERT_FALSE( l.empty() ); + ASSERT_FALSE( l.empty()); ASSERT_CONTAINER_SIZE( l, nCount ); } - ASSERT_FALSE( l.empty() ); + ASSERT_FALSE( l.empty()); ASSERT_CONTAINER_SIZE( l, nSize ); // extract() test for ( auto const& i : arr ) { - ASSERT_FALSE( l.empty() ); + ASSERT_FALSE( l.empty()); ASSERT_CONTAINER_SIZE( l, nCount ); --nCount; @@ -126,7 +126,7 @@ namespace cds_test { EXPECT_FALSE( gp ); } - ASSERT_TRUE( l.empty() ); + ASSERT_TRUE( l.empty()); ASSERT_CONTAINER_SIZE( l, 0 ); } }; diff --git a/test/unit/list/test_kv_iterable_list.h b/test/unit/list/test_kv_iterable_list.h index 1ed50b5f..e148161f 100644 --- a/test/unit/list/test_kv_iterable_list.h +++ b/test/unit/list/test_kv_iterable_list.h @@ -171,7 +171,7 @@ namespace cds_test { } shuffle( arr, arr + nSize ); - ASSERT_TRUE( l.empty() ); + ASSERT_TRUE( l.empty()); ASSERT_CONTAINER_SIZE( l, 0 ); // insert/find @@ -182,7 +182,7 @@ namespace cds_test { EXPECT_FALSE( l.find( i.key, []( list_value_type& ) {} )); EXPECT_FALSE( l.find( key_type( i.key ), []( list_value_type& ) {} )); EXPECT_FALSE( l.find_with( other_key( i.key ), other_less(), []( list_value_type& ) {} )); - EXPECT_TRUE( l.find( i.key ) == l.end() ); + EXPECT_TRUE( l.find( i.key ) == l.end()); EXPECT_TRUE( l.find_with( other_key( i.key ), other_less()) == l.end()); switch ( i.key % 6 ) { @@ -275,7 +275,7 @@ namespace cds_test { ret = l.upsert( i.key, i.val ); EXPECT_TRUE( ret.first ); EXPECT_TRUE( ret.second ); - EXPECT_TRUE( l.contains( i.key ) ); + EXPECT_TRUE( l.contains( i.key )); ret = l.upsert( i.key, i.key * 12 ); EXPECT_TRUE( ret.first ); @@ -309,17 +309,17 @@ namespace cds_test { EXPECT_TRUE( pair.first ); EXPECT_FALSE( pair.second ); - EXPECT_FALSE( l.find( i.key ) == l.end() ); + EXPECT_FALSE( l.find( i.key ) == l.end()); EXPECT_EQ( l.find( i.key )->first.nKey, i.key ); EXPECT_EQ( l.find( i.key )->second.val, i.key * 3 ); - EXPECT_FALSE( l.find_with( other_key( i.key ), other_less() ) == l.end() ); + EXPECT_FALSE( l.find_with( other_key( i.key ), other_less()) == l.end()); EXPECT_EQ( l.find_with( other_key( i.key ), other_less())->first.nKey, i.key ); EXPECT_EQ( l.find_with( other_key( i.key ), other_less())->second.val, i.key * 3 ); - EXPECT_FALSE( l.empty() ); + EXPECT_FALSE( l.empty()); } - ASSERT_FALSE( l.empty() ); + ASSERT_FALSE( l.empty()); EXPECT_CONTAINER_SIZE( l, nSize ); // erase @@ -352,19 +352,19 @@ namespace cds_test { EXPECT_FALSE( l.find_with( other_key( i.key ), other_less(), []( list_value_type& ) {} )); } - ASSERT_TRUE( l.empty() ); + ASSERT_TRUE( l.empty()); EXPECT_CONTAINER_SIZE( l, 0 ); // clear test for ( auto& i : arr ) EXPECT_TRUE( l.insert( i.key, i.val )); - ASSERT_FALSE( l.empty() ); + ASSERT_FALSE( l.empty()); EXPECT_CONTAINER_SIZE( l, nSize ); l.clear(); - ASSERT_TRUE( l.empty() ); + ASSERT_TRUE( l.empty()); EXPECT_CONTAINER_SIZE( l, 0 ); // empty list iterator test @@ -397,7 +397,7 @@ namespace cds_test { } shuffle( arr, arr + nSize ); - ASSERT_TRUE( l.empty() ); + ASSERT_TRUE( l.empty()); ASSERT_CONTAINER_SIZE( l, 0 ); for ( auto& i : arr ) @@ -405,8 +405,8 @@ namespace cds_test { int key = 0; for ( auto& it : l ) { - EXPECT_EQ( key, it.first.key() ); - EXPECT_EQ( it.second.val, it.first.key() ); + EXPECT_EQ( key, it.first.key()); + EXPECT_EQ( it.second.val, it.first.key()); it.second.val = it.first.key() * 10; ++key; } @@ -414,7 +414,7 @@ namespace cds_test { key = 0; for ( auto it = l.cbegin(); it != l.cend(); ++it ) { - EXPECT_EQ( key, it->first.key() ); + EXPECT_EQ( key, it->first.key()); EXPECT_EQ( it->first.key() * 10, it->second.val ); ++key; } @@ -422,7 +422,7 @@ namespace cds_test { key = 0; for ( auto it = l.begin(); it != l.end(); ++it ) { - EXPECT_EQ( key, it->first.key() ); + EXPECT_EQ( key, it->first.key()); EXPECT_EQ( it->first.key() * 10, it->second.val ); it->second.val = it->first.key() * 2; ++key; @@ -439,7 +439,7 @@ namespace cds_test { EXPECT_EQ( static_cast(key), nSize ); l.clear(); - ASSERT_TRUE( l.empty() ); + ASSERT_TRUE( l.empty()); EXPECT_CONTAINER_SIZE( l, 0 ); } }; diff --git a/test/unit/list/test_kv_iterable_list_hp.h b/test/unit/list/test_kv_iterable_list_hp.h index 79c9c944..34847513 100644 --- a/test/unit/list/test_kv_iterable_list_hp.h +++ b/test/unit/list/test_kv_iterable_list_hp.h @@ -59,7 +59,7 @@ namespace cds_test { } shuffle( arr, arr + nSize ); - ASSERT_TRUE( l.empty() ); + ASSERT_TRUE( l.empty()); ASSERT_CONTAINER_SIZE( l, 0 ); guarded_ptr gp; @@ -87,16 +87,16 @@ namespace cds_test { gp->second.val = gp->first.nKey * 10; ++nCount; - ASSERT_FALSE( l.empty() ); + ASSERT_FALSE( l.empty()); ASSERT_CONTAINER_SIZE( l, nCount ); } - ASSERT_FALSE( l.empty() ); + ASSERT_FALSE( l.empty()); ASSERT_CONTAINER_SIZE( l, nSize ); // extract() test for ( auto const& i : arr ) { - ASSERT_FALSE( l.empty() ); + ASSERT_FALSE( l.empty()); ASSERT_CONTAINER_SIZE( l, nCount ); --nCount; @@ -125,7 +125,7 @@ namespace cds_test { EXPECT_FALSE( gp ); } - ASSERT_TRUE( l.empty() ); + ASSERT_TRUE( l.empty()); ASSERT_CONTAINER_SIZE( l, 0 ); } }; diff --git a/test/unit/list/test_kv_list.h b/test/unit/list/test_kv_list.h index ecdc379a..558cc676 100644 --- a/test/unit/list/test_kv_list.h +++ b/test/unit/list/test_kv_list.h @@ -171,7 +171,7 @@ namespace cds_test { } shuffle( arr, arr + nSize ); - ASSERT_TRUE( l.empty() ); + ASSERT_TRUE( l.empty()); ASSERT_CONTAINER_SIZE( l, 0 ); // insert/find @@ -286,10 +286,10 @@ namespace cds_test { EXPECT_TRUE( pair.first ); EXPECT_FALSE( pair.second ); - EXPECT_FALSE( l.empty() ); + EXPECT_FALSE( l.empty()); } - ASSERT_FALSE( l.empty() ); + ASSERT_FALSE( l.empty()); EXPECT_CONTAINER_SIZE( l, nSize ); // erase @@ -322,19 +322,19 @@ namespace cds_test { EXPECT_FALSE( l.find_with( other_key( i.key ), other_less(), []( list_value_type& ) {} )); } - ASSERT_TRUE( l.empty() ); + ASSERT_TRUE( l.empty()); EXPECT_CONTAINER_SIZE( l, 0 ); // clear test for ( auto& i : arr ) EXPECT_TRUE( l.insert( i.key, i.val )); - ASSERT_FALSE( l.empty() ); + ASSERT_FALSE( l.empty()); EXPECT_CONTAINER_SIZE( l, nSize ); l.clear(); - ASSERT_TRUE( l.empty() ); + ASSERT_TRUE( l.empty()); EXPECT_CONTAINER_SIZE( l, 0 ); // empty list iterator test @@ -367,7 +367,7 @@ namespace cds_test { } shuffle( arr, arr + nSize ); - ASSERT_TRUE( l.empty() ); + ASSERT_TRUE( l.empty()); ASSERT_CONTAINER_SIZE( l, 0 ); for ( auto& i : arr ) @@ -375,8 +375,8 @@ namespace cds_test { int key = 0; for ( auto& it : l ) { - EXPECT_EQ( key, it.first.key() ); - EXPECT_EQ( it.second.val, it.first.key() ); + EXPECT_EQ( key, it.first.key()); + EXPECT_EQ( it.second.val, it.first.key()); it.second.val = it.first.key() * 10; ++key; } @@ -384,7 +384,7 @@ namespace cds_test { key = 0; for ( auto it = l.cbegin(); it != l.cend(); ++it ) { - EXPECT_EQ( key, it->first.key() ); + EXPECT_EQ( key, it->first.key()); EXPECT_EQ( it->first.key() * 10, it->second.val ); ++key; } @@ -392,7 +392,7 @@ namespace cds_test { key = 0; for ( auto it = l.begin(); it != l.end(); ++it ) { - EXPECT_EQ( key, it->first.key() ); + EXPECT_EQ( key, it->first.key()); EXPECT_EQ( it->first.key() * 10, it->second.val ); it->second.val = it->first.key() * 2; ++key; @@ -409,7 +409,7 @@ namespace cds_test { EXPECT_EQ( static_cast(key), nSize ); l.clear(); - ASSERT_TRUE( l.empty() ); + ASSERT_TRUE( l.empty()); EXPECT_CONTAINER_SIZE( l, 0 ); } }; diff --git a/test/unit/list/test_kv_list_hp.h b/test/unit/list/test_kv_list_hp.h index b4bab92d..55f4ae00 100644 --- a/test/unit/list/test_kv_list_hp.h +++ b/test/unit/list/test_kv_list_hp.h @@ -59,7 +59,7 @@ namespace cds_test { } shuffle( arr, arr + nSize ); - ASSERT_TRUE( l.empty() ); + ASSERT_TRUE( l.empty()); ASSERT_CONTAINER_SIZE( l, 0 ); guarded_ptr gp; @@ -87,16 +87,16 @@ namespace cds_test { gp->second.val = gp->first.nKey * 10; ++nCount; - ASSERT_FALSE( l.empty() ); + ASSERT_FALSE( l.empty()); ASSERT_CONTAINER_SIZE( l, nCount ); } - ASSERT_FALSE( l.empty() ); + ASSERT_FALSE( l.empty()); ASSERT_CONTAINER_SIZE( l, nSize ); // extract() test for ( auto const& i : arr ) { - ASSERT_FALSE( l.empty() ); + ASSERT_FALSE( l.empty()); ASSERT_CONTAINER_SIZE( l, nCount ); --nCount; @@ -125,7 +125,7 @@ namespace cds_test { EXPECT_FALSE( gp ); } - ASSERT_TRUE( l.empty() ); + ASSERT_TRUE( l.empty()); ASSERT_CONTAINER_SIZE( l, 0 ); } }; diff --git a/test/unit/list/test_kv_list_nogc.h b/test/unit/list/test_kv_list_nogc.h index cec703fb..d9761fe5 100644 --- a/test/unit/list/test_kv_list_nogc.h +++ b/test/unit/list/test_kv_list_nogc.h @@ -161,7 +161,7 @@ namespace cds_test { } shuffle( arr, arr + nSize ); - ASSERT_TRUE( l.empty() ); + ASSERT_TRUE( l.empty()); ASSERT_CONTAINER_SIZE( l, 0 ); // insert/find @@ -178,39 +178,39 @@ namespace cds_test { EXPECT_EQ( it->first.key, i.key ); EXPECT_EQ( it->second.val, 0 ); it = l.contains( i.key ); - EXPECT_FALSE( it == l.end() ); + EXPECT_FALSE( it == l.end()); EXPECT_EQ( it->first.key, i.key ); EXPECT_EQ( it->second.val, 0 ); it = l.insert( i.key ); - EXPECT_TRUE( it == l.end() ); + EXPECT_TRUE( it == l.end()); break; } case 1: { auto it = l.insert( i.key, i.val ); - ASSERT_FALSE( it == l.end() ); + ASSERT_FALSE( it == l.end()); EXPECT_EQ( it->first.key, i.key ); EXPECT_EQ( it->second.val, i.val ); it = l.contains( key_type( i.key )); - EXPECT_FALSE( it == l.end() ); + EXPECT_FALSE( it == l.end()); EXPECT_EQ( it->first.key, i.key ); EXPECT_EQ( it->second.val, i.val ); it = l.insert( key_type( i.key ), i.val ); - EXPECT_TRUE( it == l.end() ); + EXPECT_TRUE( it == l.end()); break; } case 2: { auto it = l.emplace( i.key, i.key * 100 ); - ASSERT_FALSE( it == l.end() ); + ASSERT_FALSE( it == l.end()); EXPECT_EQ( it->first.key, i.key ); EXPECT_EQ( it->second.val, i.key * 100 ); it = l.contains( other_key( i.key ), other_less()); - ASSERT_FALSE( it == l.end() ); + ASSERT_FALSE( it == l.end()); EXPECT_EQ( it->first.key, i.key ); EXPECT_EQ( it->second.val, i.key * 100 ); it = l.emplace( i.key, i.key * 50 ); - EXPECT_TRUE( it == l.end() ); + EXPECT_TRUE( it == l.end()); break; } case 3: @@ -220,25 +220,25 @@ namespace cds_test { EXPECT_FALSE( pair.second ); pair = l.update( i.key ); - ASSERT_FALSE( pair.first == l.end() ); + ASSERT_FALSE( pair.first == l.end()); EXPECT_TRUE( pair.second ); pair.first->second.val = i.key * 3; - auto it = l.contains( other_key( i.key ), other_less() ); - ASSERT_FALSE( it == l.end() ); + auto it = l.contains( other_key( i.key ), other_less()); + ASSERT_FALSE( it == l.end()); EXPECT_TRUE( it == pair.first ); EXPECT_EQ( it->first.key, i.key ); EXPECT_EQ( it->second.val, i.key * 3 ); pair = l.update( i.key, false ); - ASSERT_FALSE( pair.first == l.end() ); + ASSERT_FALSE( pair.first == l.end()); EXPECT_TRUE( pair.first == it ); EXPECT_FALSE( pair.second ); EXPECT_EQ( pair.first->first.key, i.key ); pair.first->second.val = i.key * 5; - it = l.contains( other_key( i.key ), other_less() ); - ASSERT_FALSE( it == l.end() ); + it = l.contains( other_key( i.key ), other_less()); + ASSERT_FALSE( it == l.end()); EXPECT_TRUE( it == pair.first ); EXPECT_EQ( it->first.key, i.key ); EXPECT_EQ( it->second.val, i.key * 5 ); @@ -250,17 +250,17 @@ namespace cds_test { EXPECT_EQ( i.key, n.first.key ); n.second.val = n.first.key * 7; }); - ASSERT_FALSE( it == l.end() ); + ASSERT_FALSE( it == l.end()); EXPECT_EQ( it->first.key, i.key ); EXPECT_EQ( it->second.val, i.key * 7 ); it = l.contains( i.key ); - ASSERT_FALSE( it == l.end() ); + ASSERT_FALSE( it == l.end()); EXPECT_EQ( it->first.key, i.key ); EXPECT_EQ( it->second.val, i.key * 7 ); it = l.insert_with( i.key, []( list_value_type& ) { EXPECT_TRUE( false ); }); - EXPECT_TRUE( it == l.end() ); + EXPECT_TRUE( it == l.end()); break; } } @@ -269,15 +269,15 @@ namespace cds_test { EXPECT_TRUE( l.contains( key_type( i.key )) != l.end()); EXPECT_TRUE( l.contains( other_key( i.key ), other_less()) != l.end()); - EXPECT_FALSE( l.empty() ); + EXPECT_FALSE( l.empty()); } - ASSERT_FALSE( l.empty() ); + ASSERT_FALSE( l.empty()); EXPECT_CONTAINER_SIZE( l, nSize ); l.clear(); - ASSERT_TRUE( l.empty() ); + ASSERT_TRUE( l.empty()); EXPECT_CONTAINER_SIZE( l, 0 ); // empty list iterator test @@ -311,7 +311,7 @@ namespace cds_test { } shuffle( arr, arr + nSize ); - ASSERT_TRUE( l.empty() ); + ASSERT_TRUE( l.empty()); ASSERT_CONTAINER_SIZE( l, 0 ); for ( auto& i : arr ) @@ -354,7 +354,7 @@ namespace cds_test { EXPECT_EQ( static_cast(key), nSize ); l.clear(); - ASSERT_TRUE( l.empty() ); + ASSERT_TRUE( l.empty()); EXPECT_CONTAINER_SIZE( l, 0 ); } }; diff --git a/test/unit/list/test_kv_list_rcu.h b/test/unit/list/test_kv_list_rcu.h index 660c37b1..6a247747 100644 --- a/test/unit/list/test_kv_list_rcu.h +++ b/test/unit/list/test_kv_list_rcu.h @@ -57,7 +57,7 @@ namespace cds_test { } shuffle( arr, arr + nSize ); - ASSERT_TRUE( l.empty() ); + ASSERT_TRUE( l.empty()); ASSERT_CONTAINER_SIZE( l, 0 ); typedef typename List::exempt_ptr exempt_ptr; @@ -70,7 +70,7 @@ namespace cds_test { rcu_lock lock; raw_ptr rp = l.get( i.key ); EXPECT_TRUE( !rp ); - rp = l.get_with( other_key( i.key ), other_less() ); + rp = l.get_with( other_key( i.key ), other_less()); EXPECT_TRUE( !rp ); } @@ -99,7 +99,7 @@ namespace cds_test { } } - ASSERT_FALSE( l.empty() ); + ASSERT_FALSE( l.empty()); ASSERT_CONTAINER_SIZE( l, nSize ); // extract() @@ -144,7 +144,7 @@ namespace cds_test { } } - ASSERT_TRUE( l.empty() ); + ASSERT_TRUE( l.empty()); ASSERT_CONTAINER_SIZE( l, 0 ); } }; diff --git a/test/unit/list/test_list.h b/test/unit/list/test_list.h index 12d01ea3..97e88e70 100644 --- a/test/unit/list/test_list.h +++ b/test/unit/list/test_list.h @@ -92,7 +92,7 @@ namespace cds_test { struct cmp { int operator ()( const T& v1, const T& v2 ) const { - if ( v1.key() < v2.key() ) + if ( v1.key() < v2.key()) return -1; return v1.key() > v2.key() ? 1 : 0; } @@ -108,7 +108,7 @@ namespace cds_test { template int operator ()( const Q& v1, const T& v2 ) const { - if ( v1 < v2.key() ) + if ( v1 < v2.key()) return -1; return v1 > v2.key() ? 1 : 0; } @@ -152,7 +152,7 @@ namespace cds_test { } shuffle( arr, arr + nSize ); - ASSERT_TRUE( l.empty() ); + ASSERT_TRUE( l.empty()); ASSERT_CONTAINER_SIZE( l, 0 ); // insert/find @@ -240,10 +240,10 @@ namespace cds_test { EXPECT_TRUE( pair.first ); EXPECT_FALSE( pair.second ); - EXPECT_FALSE( l.empty() ); + EXPECT_FALSE( l.empty()); } - ASSERT_FALSE( l.empty() ); + ASSERT_FALSE( l.empty()); EXPECT_CONTAINER_SIZE( l, nSize ); // erase @@ -276,19 +276,19 @@ namespace cds_test { EXPECT_FALSE( l.find_with( other_item( i.nKey ), other_less(), []( value_type&, other_item const& ) {} )); } - ASSERT_TRUE( l.empty() ); + ASSERT_TRUE( l.empty()); EXPECT_CONTAINER_SIZE( l, 0 ); // clear test for ( auto& i : arr ) EXPECT_TRUE( l.insert( i )); - ASSERT_FALSE( l.empty() ); + ASSERT_FALSE( l.empty()); EXPECT_CONTAINER_SIZE( l, nSize ); l.clear(); - ASSERT_TRUE( l.empty() ); + ASSERT_TRUE( l.empty()); EXPECT_CONTAINER_SIZE( l, 0 ); // empty list iterator test @@ -318,7 +318,7 @@ namespace cds_test { } shuffle( arr, arr + nSize ); - ASSERT_TRUE( l.empty() ); + ASSERT_TRUE( l.empty()); ASSERT_CONTAINER_SIZE( l, 0 ); for ( auto& i : arr ) @@ -363,7 +363,7 @@ namespace cds_test { EXPECT_EQ( static_cast(key), nSize ); l.clear(); - ASSERT_TRUE( l.empty() ); + ASSERT_TRUE( l.empty()); EXPECT_CONTAINER_SIZE( l, 0 ); } }; diff --git a/test/unit/list/test_list_hp.h b/test/unit/list/test_list_hp.h index 2ba68725..6c4a3975 100644 --- a/test/unit/list/test_list_hp.h +++ b/test/unit/list/test_list_hp.h @@ -55,7 +55,7 @@ namespace cds_test { } shuffle( arr, arr + nSize ); - ASSERT_TRUE( l.empty() ); + ASSERT_TRUE( l.empty()); ASSERT_CONTAINER_SIZE( l, 0 ); guarded_ptr gp; @@ -83,16 +83,16 @@ namespace cds_test { gp->nVal = gp->nKey * 10; ++nCount; - ASSERT_FALSE( l.empty() ); + ASSERT_FALSE( l.empty()); ASSERT_CONTAINER_SIZE( l, nCount ); } - ASSERT_FALSE( l.empty() ); + ASSERT_FALSE( l.empty()); ASSERT_CONTAINER_SIZE( l, nSize ); // extract() test for ( auto const& i : arr ) { - ASSERT_FALSE( l.empty() ); + ASSERT_FALSE( l.empty()); ASSERT_CONTAINER_SIZE( l, nCount ); --nCount; @@ -126,7 +126,7 @@ namespace cds_test { EXPECT_FALSE( gp ); } - ASSERT_TRUE( l.empty() ); + ASSERT_TRUE( l.empty()); ASSERT_CONTAINER_SIZE( l, 0 ); } }; diff --git a/test/unit/list/test_list_nogc.h b/test/unit/list/test_list_nogc.h index 21d9c03b..d78ada68 100644 --- a/test/unit/list/test_list_nogc.h +++ b/test/unit/list/test_list_nogc.h @@ -92,7 +92,7 @@ namespace cds_test { struct cmp { int operator ()( const T& v1, const T& v2 ) const { - if ( v1.key() < v2.key() ) + if ( v1.key() < v2.key()) return -1; return v1.key() > v2.key() ? 1 : 0; } @@ -108,7 +108,7 @@ namespace cds_test { template int operator ()( const Q& v1, const T& v2 ) const { - if ( v1 < v2.key() ) + if ( v1 < v2.key()) return -1; return v1 > v2.key() ? 1 : 0; } @@ -152,7 +152,7 @@ namespace cds_test { } shuffle( arr, arr + nSize ); - ASSERT_TRUE( l.empty() ); + ASSERT_TRUE( l.empty()); ASSERT_CONTAINER_SIZE( l, 0 ); // insert/find @@ -169,39 +169,39 @@ namespace cds_test { EXPECT_EQ( it->nKey, i.nKey ); EXPECT_EQ( it->nVal, it->nKey * 2 ); it = l.contains( i.nKey ); - EXPECT_FALSE( it == l.end() ); + EXPECT_FALSE( it == l.end()); EXPECT_EQ( it->nKey, i.nKey ); EXPECT_EQ( it->nVal, it->nKey * 2 ); it = l.insert( i.nKey ); - EXPECT_TRUE( it == l.end() ); + EXPECT_TRUE( it == l.end()); break; } case 1: { auto it = l.insert( i ); - EXPECT_FALSE( it == l.end() ); + EXPECT_FALSE( it == l.end()); EXPECT_EQ( it->nKey, i.nKey ); EXPECT_EQ( it->nVal, i.nVal ); it = l.contains( i ); - EXPECT_FALSE( it == l.end() ); + EXPECT_FALSE( it == l.end()); EXPECT_EQ( it->nKey, i.nKey ); EXPECT_EQ( it->nVal, i.nVal ); it = l.insert( i ); - EXPECT_TRUE( it == l.end() ); + EXPECT_TRUE( it == l.end()); break; } case 2: { auto it = l.emplace( i.nKey, i.nKey * 100 ); - EXPECT_FALSE( it == l.end() ); + EXPECT_FALSE( it == l.end()); EXPECT_EQ( it->nKey, i.nKey ); EXPECT_EQ( it->nVal, i.nKey * 100 ); it = l.contains( other_item( i.nKey ), other_less()); - EXPECT_FALSE( it == l.end() ); + EXPECT_FALSE( it == l.end()); EXPECT_EQ( it->nKey, i.nKey ); EXPECT_EQ( it->nVal, i.nKey * 100 ); it = l.emplace( i.nKey, i.nKey * 50 ); - EXPECT_TRUE( it == l.end() ); + EXPECT_TRUE( it == l.end()); break; } case 3: @@ -211,26 +211,26 @@ namespace cds_test { EXPECT_FALSE( pair.second ); pair = l.update( i.nKey ); - EXPECT_FALSE( pair.first == l.end() ); + EXPECT_FALSE( pair.first == l.end()); EXPECT_TRUE( pair.second ); pair.first->nVal = i.nKey * 3; EXPECT_EQ( pair.first->nKey, i.nKey ); - auto it = l.contains( other_item( i.nKey ), other_less() ); - EXPECT_FALSE( it == l.end() ); + auto it = l.contains( other_item( i.nKey ), other_less()); + EXPECT_FALSE( it == l.end()); EXPECT_TRUE( it == pair.first ); EXPECT_EQ( it->nKey, i.nKey ); EXPECT_EQ( it->nVal, i.nKey * 3 ); pair = l.update( i.nKey, false ); - EXPECT_FALSE( pair.first == l.end() ); + EXPECT_FALSE( pair.first == l.end()); EXPECT_TRUE( pair.first == it ); EXPECT_FALSE( pair.second ); EXPECT_EQ( pair.first->nKey, i.nKey ); pair.first->nVal = i.nKey * 5; - it = l.contains( other_item( i.nKey ), other_less() ); - EXPECT_FALSE( it == l.end() ); + it = l.contains( other_item( i.nKey ), other_less()); + EXPECT_FALSE( it == l.end()); EXPECT_TRUE( it == pair.first ); EXPECT_EQ( it->nKey, i.nKey ); EXPECT_EQ( it->nVal, i.nKey * 5 ); @@ -242,15 +242,15 @@ namespace cds_test { EXPECT_TRUE( l.contains( i.nKey ) != l.end()); EXPECT_TRUE( l.contains( other_item( i.nKey ), other_less()) != l.end()); - EXPECT_FALSE( l.empty() ); + EXPECT_FALSE( l.empty()); } - ASSERT_FALSE( l.empty() ); + ASSERT_FALSE( l.empty()); EXPECT_CONTAINER_SIZE( l, nSize ); l.clear(); - ASSERT_TRUE( l.empty() ); + ASSERT_TRUE( l.empty()); EXPECT_CONTAINER_SIZE( l, 0 ); // empty list iterator test @@ -280,7 +280,7 @@ namespace cds_test { } shuffle( arr, arr + nSize ); - ASSERT_TRUE( l.empty() ); + ASSERT_TRUE( l.empty()); ASSERT_CONTAINER_SIZE( l, 0 ); for ( auto& i : arr ) @@ -325,7 +325,7 @@ namespace cds_test { EXPECT_EQ( static_cast(key), nSize ); l.clear(); - ASSERT_TRUE( l.empty() ); + ASSERT_TRUE( l.empty()); EXPECT_CONTAINER_SIZE( l, 0 ); } }; diff --git a/test/unit/list/test_list_rcu.h b/test/unit/list/test_list_rcu.h index cf4b2cb1..eff095dd 100644 --- a/test/unit/list/test_list_rcu.h +++ b/test/unit/list/test_list_rcu.h @@ -54,7 +54,7 @@ namespace cds_test { } shuffle( arr, arr + nSize ); - ASSERT_TRUE( l.empty() ); + ASSERT_TRUE( l.empty()); ASSERT_CONTAINER_SIZE( l, 0 ); typedef typename List::exempt_ptr exempt_ptr; @@ -67,11 +67,11 @@ namespace cds_test { rcu_lock lock; raw_ptr rp = l.get( i.nKey ); EXPECT_TRUE( !rp ); - rp = l.get_with( other_item( i.nKey ), other_less() ); + rp = l.get_with( other_item( i.nKey ), other_less()); EXPECT_TRUE( !rp ); } - EXPECT_TRUE( l.insert( i ) ); + EXPECT_TRUE( l.insert( i )); { rcu_lock lock; @@ -96,7 +96,7 @@ namespace cds_test { } } - ASSERT_FALSE( l.empty() ); + ASSERT_FALSE( l.empty()); ASSERT_CONTAINER_SIZE( l, nSize ); // extract() @@ -141,7 +141,7 @@ namespace cds_test { } } - ASSERT_TRUE( l.empty() ); + ASSERT_TRUE( l.empty()); ASSERT_CONTAINER_SIZE( l, 0 ); } }; diff --git a/test/unit/map/skiplist_nogc.cpp b/test/unit/map/skiplist_nogc.cpp index 47fa0fdd..68ea52df 100644 --- a/test/unit/map/skiplist_nogc.cpp +++ b/test/unit/map/skiplist_nogc.cpp @@ -49,7 +49,7 @@ namespace { base_class::test( m ); - ASSERT_TRUE( m.empty() ); + ASSERT_TRUE( m.empty()); ASSERT_CONTAINER_SIZE( m, 0 ); typedef typename Map::value_type map_pair; @@ -69,7 +69,7 @@ namespace { } m.clear(); - ASSERT_TRUE( m.empty() ); + ASSERT_TRUE( m.empty()); ASSERT_CONTAINER_SIZE( m, 0 ); // get_max diff --git a/test/unit/map/test_feldman_hashmap.h b/test/unit/map/test_feldman_hashmap.h index ea782227..90ea6e30 100644 --- a/test/unit/map/test_feldman_hashmap.h +++ b/test/unit/map/test_feldman_hashmap.h @@ -52,7 +52,7 @@ namespace cds_test { // Precondition: map is empty // Postcondition: map is empty - ASSERT_TRUE( m.empty() ); + ASSERT_TRUE( m.empty()); ASSERT_CONTAINER_SIZE( m, 0 ); typedef typename Map::value_type map_pair; @@ -60,8 +60,8 @@ namespace cds_test { std::vector arrKeys; for ( int i = 0; i < static_cast(kkSize); ++i ) - arrKeys.push_back( key_type( i ) ); - shuffle( arrKeys.begin(), arrKeys.end() ); + arrKeys.push_back( key_type( i )); + shuffle( arrKeys.begin(), arrKeys.end()); std::vector< value_type > arrVals; for ( size_t i = 0; i < kkSize; ++i ) { @@ -73,82 +73,82 @@ namespace cds_test { // insert/find for ( auto const& i : arrKeys ) { - value_type const& val( arrVals.at( i.nKey ) ); + value_type const& val( arrVals.at( i.nKey )); - ASSERT_FALSE( m.contains( i.nKey ) ); - ASSERT_FALSE( m.contains( i ) ); + ASSERT_FALSE( m.contains( i.nKey )); + ASSERT_FALSE( m.contains( i )); ASSERT_FALSE( m.find( i, []( map_pair const& ) { ASSERT_TRUE( false ); - } ) ); + } )); ASSERT_FALSE( m.find( i.nKey, []( map_pair const& ) { EXPECT_TRUE( false ); - } ) ); + } )); std::pair< bool, bool > updResult; switch ( i.nKey % 16 ) { case 0: - ASSERT_TRUE( m.insert( i ) ); - ASSERT_FALSE( m.insert( i ) ); + ASSERT_TRUE( m.insert( i )); + ASSERT_FALSE( m.insert( i )); ASSERT_TRUE( m.find( i.nKey, []( map_pair& v ) { v.second.nVal = v.first.nKey; v.second.strVal = std::to_string( v.first.nKey ); - } ) ); + } )); break; case 1: - ASSERT_TRUE( m.insert( i.nKey ) ); - ASSERT_FALSE( m.insert( i.nKey ) ); + ASSERT_TRUE( m.insert( i.nKey )); + ASSERT_FALSE( m.insert( i.nKey )); ASSERT_TRUE( m.find( i.nKey, []( map_pair& v ) { v.second.nVal = v.first.nKey; v.second.strVal = std::to_string( v.first.nKey ); - } ) ); + } )); break; case 2: - ASSERT_TRUE( m.insert( std::to_string( i.nKey ) ) ); - ASSERT_FALSE( m.insert( std::to_string( i.nKey ) ) ); + ASSERT_TRUE( m.insert( std::to_string( i.nKey )) ); + ASSERT_FALSE( m.insert( std::to_string( i.nKey )) ); ASSERT_TRUE( m.find( i.nKey, []( map_pair& v ) { v.second.nVal = v.first.nKey; v.second.strVal = std::to_string( v.first.nKey ); - } ) ); + } )); break; case 3: - ASSERT_TRUE( m.insert( i, val ) ); - ASSERT_FALSE( m.insert( i, val ) ); + ASSERT_TRUE( m.insert( i, val )); + ASSERT_FALSE( m.insert( i, val )); break; case 4: - ASSERT_TRUE( m.insert( i.nKey, val.strVal ) ); - ASSERT_FALSE( m.insert( i.nKey, val.strVal ) ); + ASSERT_TRUE( m.insert( i.nKey, val.strVal )); + ASSERT_FALSE( m.insert( i.nKey, val.strVal )); break; case 5: - ASSERT_TRUE( m.insert( val.strVal, i.nKey ) ); - ASSERT_FALSE( m.insert( val.strVal, i.nKey ) ); + ASSERT_TRUE( m.insert( val.strVal, i.nKey )); + ASSERT_FALSE( m.insert( val.strVal, i.nKey )); break; case 6: ASSERT_TRUE( m.insert_with( i, []( map_pair& v ) { v.second.nVal = v.first.nKey; v.second.strVal = std::to_string( v.first.nKey ); - } ) ); + } )); ASSERT_FALSE( m.insert_with( i, []( map_pair& ) { EXPECT_TRUE( false ); - } ) ); + } )); break; case 7: ASSERT_TRUE( m.insert_with( i.nKey, []( map_pair& v ) { v.second.nVal = v.first.nKey; v.second.strVal = std::to_string( v.first.nKey ); - } ) ); + } )); ASSERT_FALSE( m.insert_with( i.nKey, []( map_pair& ) { EXPECT_TRUE( false ); - } ) ); + } )); break; case 8: ASSERT_TRUE( m.insert_with( val.strVal, []( map_pair& v ) { v.second.nVal = v.first.nKey; v.second.strVal = std::to_string( v.first.nKey ); - } ) ); + } )); ASSERT_FALSE( m.insert_with( val.strVal, []( map_pair& ) { EXPECT_TRUE( false ); - } ) ); + } )); break; case 9: updResult = m.update( i.nKey, []( map_pair&, map_pair* ) { @@ -220,56 +220,56 @@ namespace cds_test { ASSERT_FALSE( updResult.second ); break; case 12: - ASSERT_TRUE( m.emplace( i.nKey ) ); - ASSERT_FALSE( m.emplace( i.nKey ) ); + ASSERT_TRUE( m.emplace( i.nKey )); + ASSERT_FALSE( m.emplace( i.nKey )); ASSERT_TRUE( m.find( i.nKey, []( map_pair& v ) { v.second.nVal = v.first.nKey; v.second.strVal = std::to_string( v.first.nKey ); - } ) ); + } )); break; case 13: - ASSERT_TRUE( m.emplace( i, i.nKey ) ); - ASSERT_FALSE( m.emplace( i, i.nKey ) ); + ASSERT_TRUE( m.emplace( i, i.nKey )); + ASSERT_FALSE( m.emplace( i, i.nKey )); break; case 14: { std::string str = val.strVal; - ASSERT_TRUE( m.emplace( i, std::move( str ) ) ); - ASSERT_TRUE( str.empty() ); + ASSERT_TRUE( m.emplace( i, std::move( str )) ); + ASSERT_TRUE( str.empty()); str = val.strVal; - ASSERT_FALSE( m.emplace( i, std::move( str ) ) ); - ASSERT_TRUE( str.empty() ); + ASSERT_FALSE( m.emplace( i, std::move( str )) ); + ASSERT_TRUE( str.empty()); } break; case 15: { std::string str = val.strVal; - ASSERT_TRUE( m.emplace( i, i.nKey, std::move( str ) ) ); - ASSERT_TRUE( str.empty() ); + ASSERT_TRUE( m.emplace( i, i.nKey, std::move( str )) ); + ASSERT_TRUE( str.empty()); str = val.strVal; - ASSERT_FALSE( m.emplace( i, i.nKey, std::move( str ) ) ); - ASSERT_TRUE( str.empty() ); + ASSERT_FALSE( m.emplace( i, i.nKey, std::move( str )) ); + ASSERT_TRUE( str.empty()); } break; } - ASSERT_TRUE( m.contains( i.nKey ) ); - ASSERT_TRUE( m.contains( i ) ); + ASSERT_TRUE( m.contains( i.nKey )); + ASSERT_TRUE( m.contains( i )); ASSERT_TRUE( m.find( i, []( map_pair const& v ) { EXPECT_EQ( v.first.nKey, v.second.nVal ); EXPECT_EQ( std::to_string( v.first.nKey ), v.second.strVal ); - } ) ); + } )); ASSERT_TRUE( m.find( i.nKey, []( map_pair const& v ) { EXPECT_EQ( v.first.nKey, v.second.nVal ); EXPECT_EQ( std::to_string( v.first.nKey ), v.second.strVal ); - } ) ); + } )); } - ASSERT_FALSE( m.empty() ); + ASSERT_FALSE( m.empty()); ASSERT_CONTAINER_SIZE( m, kkSize ); - ASSERT_FALSE( m.begin() == m.end() ); - ASSERT_FALSE( m.cbegin() == m.cend() ); + ASSERT_FALSE( m.begin() == m.end()); + ASSERT_FALSE( m.cbegin() == m.cend()); - shuffle( arrKeys.begin(), arrKeys.end() ); + shuffle( arrKeys.begin(), arrKeys.end()); { std::vector< typename Map::level_statistics > vect; @@ -278,88 +278,88 @@ namespace cds_test { // erase/find for ( auto const& i : arrKeys ) { - value_type const& val( arrVals.at( i.nKey ) ); + value_type const& val( arrVals.at( i.nKey )); - ASSERT_TRUE( m.contains( i.nKey ) ); - ASSERT_TRUE( m.contains( val.strVal ) ); - ASSERT_TRUE( m.contains( i ) ); + ASSERT_TRUE( m.contains( i.nKey )); + ASSERT_TRUE( m.contains( val.strVal )); + ASSERT_TRUE( m.contains( i )); ASSERT_TRUE( m.find( i, []( map_pair const& v ) { EXPECT_EQ( v.first.nKey, v.second.nVal ); EXPECT_EQ( std::to_string( v.first.nKey ), v.second.strVal ); - } ) ); + } )); ASSERT_TRUE( m.find( i.nKey, []( map_pair const& v ) { EXPECT_EQ( v.first.nKey, v.second.nVal ); EXPECT_EQ( std::to_string( v.first.nKey ), v.second.strVal ); - } ) ); + } )); switch ( i.nKey % 6 ) { case 0: - ASSERT_TRUE( m.erase( i ) ); - ASSERT_FALSE( m.erase( i ) ); + ASSERT_TRUE( m.erase( i )); + ASSERT_FALSE( m.erase( i )); break; case 1: - ASSERT_TRUE( m.erase( i.nKey ) ); - ASSERT_FALSE( m.erase( i.nKey ) ); + ASSERT_TRUE( m.erase( i.nKey )); + ASSERT_FALSE( m.erase( i.nKey )); break; case 2: - ASSERT_TRUE( m.erase( val.strVal ) ); - ASSERT_FALSE( m.erase( val.strVal ) ); + ASSERT_TRUE( m.erase( val.strVal )); + ASSERT_FALSE( m.erase( val.strVal )); break; case 3: ASSERT_TRUE( m.erase( i, []( map_pair& v ) { EXPECT_EQ( v.first.nKey, v.second.nVal ); EXPECT_EQ( std::to_string( v.first.nKey ), v.second.strVal ); - } ) ); + } )); ASSERT_FALSE( m.erase( i, []( map_pair& ) { EXPECT_TRUE( false ); - } ) ); + } )); break; case 4: ASSERT_TRUE( m.erase( i.nKey, []( map_pair& v ) { EXPECT_EQ( v.first.nKey, v.second.nVal ); EXPECT_EQ( std::to_string( v.first.nKey ), v.second.strVal ); - } ) ); + } )); ASSERT_FALSE( m.erase( i.nKey, []( map_pair& ) { EXPECT_TRUE( false ); - } ) ); + } )); break; case 5: ASSERT_TRUE( m.erase( val.strVal, []( map_pair& v ) { EXPECT_EQ( v.first.nKey, v.second.nVal ); EXPECT_EQ( std::to_string( v.first.nKey ), v.second.strVal ); - } ) ); + } )); ASSERT_FALSE( m.erase( val.strVal, []( map_pair& ) { EXPECT_TRUE( false ); - } ) ); + } )); break; } - ASSERT_FALSE( m.contains( i.nKey ) ); - ASSERT_FALSE( m.contains( i ) ); - ASSERT_FALSE( m.contains( val.strVal ) ); + ASSERT_FALSE( m.contains( i.nKey )); + ASSERT_FALSE( m.contains( i )); + ASSERT_FALSE( m.contains( val.strVal )); ASSERT_FALSE( m.find( i, []( map_pair const& ) { ASSERT_TRUE( false ); - } ) ); + } )); ASSERT_FALSE( m.find( i.nKey, []( map_pair const& ) { EXPECT_TRUE( false ); - } ) ); + } )); } - ASSERT_TRUE( m.empty() ); + ASSERT_TRUE( m.empty()); ASSERT_CONTAINER_SIZE( m, 0 ); - ASSERT_TRUE( m.begin() == m.end() ); - ASSERT_TRUE( m.cbegin() == m.cend() ); + ASSERT_TRUE( m.begin() == m.end()); + ASSERT_TRUE( m.cbegin() == m.cend()); // clear for ( auto const& i : arrKeys ) - ASSERT_TRUE( m.insert( i ) ); + ASSERT_TRUE( m.insert( i )); - ASSERT_FALSE( m.empty() ); + ASSERT_FALSE( m.empty()); ASSERT_CONTAINER_SIZE( m, kkSize ); m.clear(); - ASSERT_TRUE( m.empty() ); + ASSERT_TRUE( m.empty()); ASSERT_CONTAINER_SIZE( m, 0 ); } }; diff --git a/test/unit/map/test_feldman_hashmap_hp.h b/test/unit/map/test_feldman_hashmap_hp.h index 0c55aaa6..3b22a9fb 100644 --- a/test/unit/map/test_feldman_hashmap_hp.h +++ b/test/unit/map/test_feldman_hashmap_hp.h @@ -68,8 +68,8 @@ namespace cds_test { } for ( auto const& i : arrKeys ) - ASSERT_TRUE( m.insert( i ) ); - ASSERT_FALSE( m.empty() ); + ASSERT_TRUE( m.insert( i )); + ASSERT_FALSE( m.empty()); ASSERT_CONTAINER_SIZE( m, kkSize ); // iterators @@ -139,13 +139,13 @@ namespace cds_test { gp = m.get( i ); ASSERT_TRUE( !gp ); } - ASSERT_TRUE( m.empty() ); + ASSERT_TRUE( m.empty()); ASSERT_CONTAINER_SIZE( m, 0 ); // erase_at( iterator ) for ( auto const& i : arrKeys ) - ASSERT_TRUE( m.insert( i ) ); - ASSERT_FALSE( m.empty() ); + ASSERT_TRUE( m.insert( i )); + ASSERT_FALSE( m.empty()); ASSERT_CONTAINER_SIZE( m, kkSize ); nCount = 0; @@ -155,55 +155,55 @@ namespace cds_test { ++nCount; } EXPECT_EQ( nCount, kkSize ); - ASSERT_TRUE( m.empty() ); + ASSERT_TRUE( m.empty()); ASSERT_CONTAINER_SIZE( m, 0 ); // erase_at( reverse_iterator ) for ( auto const& i : arrKeys ) - ASSERT_TRUE( m.insert( i ) ); - ASSERT_FALSE( m.empty() ); + ASSERT_TRUE( m.insert( i )); + ASSERT_FALSE( m.empty()); ASSERT_CONTAINER_SIZE( m, kkSize ); nCount = 0; for ( auto it = m.rbegin(); it != m.rend(); ++it ) { EXPECT_EQ( it->second.nVal, 0 ); - ASSERT_TRUE( m.erase_at( it ) ); + ASSERT_TRUE( m.erase_at( it )); ++nCount; } EXPECT_EQ( nCount, kkSize ); - ASSERT_TRUE( m.empty() ); + ASSERT_TRUE( m.empty()); ASSERT_CONTAINER_SIZE( m, 0 ); // erase_at( const_reverse_iterator ) for ( auto const& i : arrKeys ) - ASSERT_TRUE( m.insert( i ) ); - ASSERT_FALSE( m.empty() ); + ASSERT_TRUE( m.insert( i )); + ASSERT_FALSE( m.empty()); ASSERT_CONTAINER_SIZE( m, kkSize ); nCount = 0; for ( auto it = m.crbegin(); it != m.crend(); ++it ) { EXPECT_EQ( it->second.nVal, 0 ); - ASSERT_TRUE( m.erase_at( it ) ); + ASSERT_TRUE( m.erase_at( it )); ++nCount; } EXPECT_EQ( nCount, kkSize ); - ASSERT_TRUE( m.empty() ); + ASSERT_TRUE( m.empty()); ASSERT_CONTAINER_SIZE( m, 0 ); // erase_at( const_iterator ) for ( auto const& i : arrKeys ) - ASSERT_TRUE( m.insert( i ) ); - ASSERT_FALSE( m.empty() ); + ASSERT_TRUE( m.insert( i )); + ASSERT_FALSE( m.empty()); ASSERT_CONTAINER_SIZE( m, kkSize ); nCount = 0; for ( auto it = m.cbegin(); it != m.cend(); ++it ) { EXPECT_EQ( it->second.nVal, 0 ); - ASSERT_TRUE( m.erase_at( it ) ); + ASSERT_TRUE( m.erase_at( it )); ++nCount; } EXPECT_EQ( nCount, kkSize ); - ASSERT_TRUE( m.empty() ); + ASSERT_TRUE( m.empty()); ASSERT_CONTAINER_SIZE( m, 0 ); } }; diff --git a/test/unit/map/test_feldman_hashmap_rcu.h b/test/unit/map/test_feldman_hashmap_rcu.h index 3a2f18df..65fc5c22 100644 --- a/test/unit/map/test_feldman_hashmap_rcu.h +++ b/test/unit/map/test_feldman_hashmap_rcu.h @@ -75,8 +75,8 @@ namespace { } for ( auto const& i : arrKeys ) - ASSERT_TRUE( m.insert( i ) ); - ASSERT_FALSE( m.empty() ); + ASSERT_TRUE( m.insert( i )); + ASSERT_FALSE( m.empty()); ASSERT_CONTAINER_SIZE( m, kkSize ); // iterators @@ -157,7 +157,7 @@ namespace { EXPECT_TRUE( p == nullptr ); } } - ASSERT_TRUE( m.empty() ); + ASSERT_TRUE( m.empty()); ASSERT_CONTAINER_SIZE( m, 0 ); } diff --git a/test/unit/map/test_map.h b/test/unit/map/test_map.h index b8c86477..6593f3b6 100644 --- a/test/unit/map/test_map.h +++ b/test/unit/map/test_map.h @@ -268,19 +268,19 @@ namespace cds_test { EXPECT_EQ( std::to_string( v.first.nKey ), v.second.strVal ); } )); } - EXPECT_FALSE( m.empty() ); + EXPECT_FALSE( m.empty()); EXPECT_CONTAINER_SIZE( m, kkSize ); - EXPECT_FALSE( m.begin() == m.end() ); - EXPECT_FALSE( m.cbegin() == m.cend() ); + EXPECT_FALSE( m.begin() == m.end()); + EXPECT_FALSE( m.cbegin() == m.cend()); - shuffle( arrKeys.begin(), arrKeys.end() ); + shuffle( arrKeys.begin(), arrKeys.end()); // erase/find for ( auto const& i : arrKeys ) { - value_type const& val( arrVals.at( i.nKey ) ); + value_type const& val( arrVals.at( i.nKey )); EXPECT_TRUE( m.contains( i.nKey )); - EXPECT_TRUE( m.contains( val.strVal ) ); + EXPECT_TRUE( m.contains( val.strVal )); EXPECT_TRUE( m.contains( i )); EXPECT_TRUE( m.contains( other_item( i.nKey ), other_less())); EXPECT_TRUE( m.find( i, []( map_pair const& v ) { @@ -366,7 +366,7 @@ namespace cds_test { EXPECT_TRUE( false ); } )); } - EXPECT_TRUE( m.empty() ); + EXPECT_TRUE( m.empty()); EXPECT_CONTAINER_SIZE( m, 0 ); EXPECT_TRUE( m.begin() == m.end()); @@ -376,12 +376,12 @@ namespace cds_test { for ( auto const& i : arrKeys ) EXPECT_TRUE( m.insert( i )); - EXPECT_FALSE( m.empty() ); + EXPECT_FALSE( m.empty()); EXPECT_CONTAINER_SIZE( m, kkSize ); m.clear(); - EXPECT_TRUE( m.empty() ); + EXPECT_TRUE( m.empty()); EXPECT_CONTAINER_SIZE( m, 0 ); } }; diff --git a/test/unit/map/test_map_hp.h b/test/unit/map/test_map_hp.h index b0797ac2..294dae55 100644 --- a/test/unit/map/test_map_hp.h +++ b/test/unit/map/test_map_hp.h @@ -67,8 +67,8 @@ namespace cds_test { } for ( auto const& i : arrKeys ) - EXPECT_TRUE( m.insert( i ) ); - EXPECT_FALSE( m.empty() ); + EXPECT_TRUE( m.insert( i )); + EXPECT_FALSE( m.empty()); EXPECT_CONTAINER_SIZE( m, kkSize ); // iterators @@ -128,10 +128,10 @@ namespace cds_test { ASSERT_TRUE( !gp ); gp = m.get( i ); ASSERT_TRUE( !gp ); - gp = m.get_with( other_item( i.nKey ), other_less() ); + gp = m.get_with( other_item( i.nKey ), other_less()); ASSERT_TRUE( !gp ); } - EXPECT_TRUE( m.empty() ); + EXPECT_TRUE( m.empty()); EXPECT_CONTAINER_SIZE( m, 0 ); } }; diff --git a/test/unit/map/test_map_nogc.h b/test/unit/map/test_map_nogc.h index 1f5dbf19..ddf12bfa 100644 --- a/test/unit/map/test_map_nogc.h +++ b/test/unit/map/test_map_nogc.h @@ -90,31 +90,31 @@ namespace cds_test { break; case 1: it = m.insert( i.nKey ); - ASSERT_FALSE( it == m.end() ); + ASSERT_FALSE( it == m.end()); ASSERT_TRUE( m.insert( i.nKey ) == m.end()); it->second.nVal = it->first.nKey; it->second.strVal = std::to_string( it->first.nKey ); break; case 2: it = m.insert( std::to_string( i.nKey )); - ASSERT_FALSE( it == m.end() ); + ASSERT_FALSE( it == m.end()); ASSERT_TRUE( m.insert( std::to_string( i.nKey )) == m.end()); it->second.nVal = it->first.nKey; it->second.strVal = std::to_string( it->first.nKey ); break; case 3: it = m.insert( i, val ); - ASSERT_FALSE( it == m.end() ); + ASSERT_FALSE( it == m.end()); ASSERT_TRUE( m.insert( i, val ) == m.end()); break; case 4: it = m.insert( i.nKey, val.strVal ); - ASSERT_FALSE( it == m.end() ); + ASSERT_FALSE( it == m.end()); ASSERT_TRUE( m.insert( i.nKey, val.strVal ) == m.end()); break; case 5: it = m.insert( val.strVal, i.nKey ); - ASSERT_FALSE( it == m.end() ); + ASSERT_FALSE( it == m.end()); ASSERT_TRUE( m.insert( val.strVal, i.nKey ) == m.end()); break; case 6: @@ -122,7 +122,7 @@ namespace cds_test { v.second.nVal = v.first.nKey; v.second.strVal = std::to_string( v.first.nKey ); } ); - ASSERT_FALSE( it == m.end() ); + ASSERT_FALSE( it == m.end()); ASSERT_TRUE( m.insert_with( i, []( map_pair& ) { EXPECT_TRUE( false ); } ) == m.end()); @@ -132,7 +132,7 @@ namespace cds_test { v.second.nVal = v.first.nKey; v.second.strVal = std::to_string( v.first.nKey ); } ); - ASSERT_FALSE( it == m.end() ); + ASSERT_FALSE( it == m.end()); ASSERT_TRUE( m.insert_with( i.nKey, []( map_pair& ) { EXPECT_TRUE( false ); } ) == m.end()); @@ -142,14 +142,14 @@ namespace cds_test { v.second.nVal = v.first.nKey; v.second.strVal = std::to_string( v.first.nKey ); } ); - ASSERT_FALSE( it == m.end() ); + ASSERT_FALSE( it == m.end()); ASSERT_TRUE( m.insert_with( val.strVal, []( map_pair& ) { EXPECT_TRUE( false ); } ) == m.end()); break; case 9: updResult = m.update( i.nKey, false ); - ASSERT_TRUE( updResult.first == m.end() ); + ASSERT_TRUE( updResult.first == m.end()); ASSERT_FALSE( updResult.second ); updResult = m.update( i.nKey ); @@ -158,14 +158,14 @@ namespace cds_test { updResult.first->second.nVal = updResult.first->first.nKey; updResult = m.update( i.nKey, false ); - ASSERT_TRUE( updResult.first != m.end() ); + ASSERT_TRUE( updResult.first != m.end()); ASSERT_FALSE( updResult.second ); EXPECT_EQ( updResult.first->first.nKey, updResult.first->second.nVal ); updResult.first->second.strVal = std::to_string( updResult.first->second.nVal ); break; case 10: updResult = m.update( i, false ); - ASSERT_TRUE( updResult.first == m.end() ); + ASSERT_TRUE( updResult.first == m.end()); ASSERT_FALSE( updResult.second ); updResult = m.update( i ); @@ -204,14 +204,14 @@ namespace cds_test { break; case 13: it = m.emplace( i, i.nKey ); - ASSERT_TRUE( it != m.end() ); + ASSERT_TRUE( it != m.end()); ASSERT_FALSE( m.emplace( i, i.nKey ) != m.end()); break; case 14: { std::string str = val.strVal; it = m.emplace( i, std::move( str )); - ASSERT_TRUE( it != m.end() ); + ASSERT_TRUE( it != m.end()); ASSERT_TRUE( str.empty()); str = val.strVal; ASSERT_FALSE( m.emplace( i, std::move( str )) != m.end()); @@ -222,7 +222,7 @@ namespace cds_test { { std::string str = val.strVal; it = m.emplace( i, i.nKey, std::move( str )); - ASSERT_TRUE( it != m.end() ); + ASSERT_TRUE( it != m.end()); ASSERT_TRUE( str.empty()); str = val.strVal; ASSERT_FALSE( m.emplace( i, i.nKey, std::move( str )) != m.end()); @@ -238,19 +238,19 @@ namespace cds_test { EXPECT_EQ( it->first.nKey, it->second.nVal ); EXPECT_EQ( std::to_string( it->first.nKey ), it->second.strVal ); } - ASSERT_FALSE( m.empty() ); + ASSERT_FALSE( m.empty()); ASSERT_CONTAINER_SIZE( m, kkSize ); - ASSERT_FALSE( m.begin() == m.end() ); - ASSERT_FALSE( m.cbegin() == m.cend() ); + ASSERT_FALSE( m.begin() == m.end()); + ASSERT_FALSE( m.cbegin() == m.cend()); // clear m.clear(); - ASSERT_TRUE( m.empty() ); + ASSERT_TRUE( m.empty()); ASSERT_CONTAINER_SIZE( m, 0 ); - ASSERT_TRUE( m.begin() == m.end() ); - ASSERT_TRUE( m.cbegin() == m.cend() ); + ASSERT_TRUE( m.begin() == m.end()); + ASSERT_TRUE( m.cbegin() == m.cend()); } }; diff --git a/test/unit/map/test_map_rcu.h b/test/unit/map/test_map_rcu.h index eb831ec8..17a4a225 100644 --- a/test/unit/map/test_map_rcu.h +++ b/test/unit/map/test_map_rcu.h @@ -67,8 +67,8 @@ namespace cds_test { } for ( auto const& i : arrKeys ) - ASSERT_TRUE( m.insert( i ) ); - ASSERT_FALSE( m.empty() ); + ASSERT_TRUE( m.insert( i )); + ASSERT_FALSE( m.empty()); ASSERT_CONTAINER_SIZE( m, kkSize ); // iterators @@ -92,7 +92,7 @@ namespace cds_test { typedef typename Map::rcu_lock rcu_lock; // get/extract - shuffle( arrKeys.begin(), arrKeys.end() ); + shuffle( arrKeys.begin(), arrKeys.end()); for ( auto const& i : arrKeys ) { value_type const& val = arrVals.at( i.nKey ); @@ -135,7 +135,7 @@ namespace cds_test { xp = m.extract( val.strVal ); break; case 3: - xp = m.extract_with( other_item( i.nKey ), other_less() ); + xp = m.extract_with( other_item( i.nKey ), other_less()); break; } ASSERT_FALSE( !xp ); @@ -158,7 +158,7 @@ namespace cds_test { xp = m.extract( val.strVal ); break; case 3: - xp = m.extract_with( other_item( i.nKey ), other_less() ); + xp = m.extract_with( other_item( i.nKey ), other_less()); break; } EXPECT_TRUE( !xp ); @@ -194,7 +194,7 @@ namespace cds_test { xp = m.extract( val.strVal ); break; case 3: - xp = m.extract_with( other_item( i.nKey ), other_less() ); + xp = m.extract_with( other_item( i.nKey ), other_less()); break; } EXPECT_TRUE( !xp ); @@ -208,12 +208,12 @@ namespace cds_test { ASSERT_TRUE( !rp ); rp = m.get( i ); ASSERT_TRUE( !rp ); - rp = m.get_with( other_item( i.nKey ), other_less() ); + rp = m.get_with( other_item( i.nKey ), other_less()); ASSERT_TRUE( !rp ); } } - ASSERT_TRUE( m.empty() ); + ASSERT_TRUE( m.empty()); ASSERT_CONTAINER_SIZE( m, 0 ); } }; diff --git a/test/unit/map/test_michael_iterable.h b/test/unit/map/test_michael_iterable.h index 0e671bdb..43432757 100644 --- a/test/unit/map/test_michael_iterable.h +++ b/test/unit/map/test_michael_iterable.h @@ -86,9 +86,9 @@ namespace cds_test { EXPECT_TRUE( false ); } )); - EXPECT_TRUE( m.find( i ) == m.end() ); - EXPECT_TRUE( m.find( i.nKey ) == m.end() ); - EXPECT_TRUE( m.find_with( other_item( i.nKey ), other_less() ) == m.end() ); + EXPECT_TRUE( m.find( i ) == m.end()); + EXPECT_TRUE( m.find( i.nKey ) == m.end()); + EXPECT_TRUE( m.find_with( other_item( i.nKey ), other_less()) == m.end()); std::pair< bool, bool > updResult; @@ -271,7 +271,7 @@ namespace cds_test { res = m.upsert( i, std::move( str )); EXPECT_TRUE( res.first ); EXPECT_FALSE( res.second ); - EXPECT_TRUE( str.empty() ); + EXPECT_TRUE( str.empty()); } break; } @@ -292,28 +292,28 @@ namespace cds_test { EXPECT_EQ( std::to_string( v.first.nKey ), v.second.strVal ); } )); - ASSERT_TRUE( m.find( i ) != m.end() ); - ASSERT_TRUE( m.find( i.nKey ) != m.end() ); - ASSERT_TRUE( m.find_with( other_item( i.nKey ), other_less() ) != m.end() ); + ASSERT_TRUE( m.find( i ) != m.end()); + ASSERT_TRUE( m.find( i.nKey ) != m.end()); + ASSERT_TRUE( m.find_with( other_item( i.nKey ), other_less()) != m.end()); EXPECT_EQ( m.find( i )->first.nKey, i.nKey ); EXPECT_EQ( m.find( i.nKey )->first.nKey, i.nKey ); - EXPECT_EQ( m.find_with( other_item( i.nKey ), other_less() )->first.nKey, i.nKey ); + EXPECT_EQ( m.find_with( other_item( i.nKey ), other_less())->first.nKey, i.nKey ); } - EXPECT_FALSE( m.empty() ); + EXPECT_FALSE( m.empty()); EXPECT_CONTAINER_SIZE( m, kkSize ); - EXPECT_FALSE( m.begin() == m.end() ); - EXPECT_FALSE( m.cbegin() == m.cend() ); + EXPECT_FALSE( m.begin() == m.end()); + EXPECT_FALSE( m.cbegin() == m.cend()); - shuffle( arrKeys.begin(), arrKeys.end() ); + shuffle( arrKeys.begin(), arrKeys.end()); // erase/find for ( auto const& i : arrKeys ) { - value_type const& val( arrVals.at( i.nKey ) ); + value_type const& val( arrVals.at( i.nKey )); EXPECT_TRUE( m.contains( i.nKey )); - EXPECT_TRUE( m.contains( val.strVal ) ); + EXPECT_TRUE( m.contains( val.strVal )); EXPECT_TRUE( m.contains( i )); EXPECT_TRUE( m.contains( other_item( i.nKey ), other_less())); EXPECT_TRUE( m.find( i, []( map_pair const& v ) { @@ -399,7 +399,7 @@ namespace cds_test { EXPECT_TRUE( false ); } )); } - EXPECT_TRUE( m.empty() ); + EXPECT_TRUE( m.empty()); EXPECT_CONTAINER_SIZE( m, 0 ); EXPECT_TRUE( m.begin() == m.end()); @@ -409,12 +409,12 @@ namespace cds_test { for ( auto const& i : arrKeys ) EXPECT_TRUE( m.insert( i )); - EXPECT_FALSE( m.empty() ); + EXPECT_FALSE( m.empty()); EXPECT_CONTAINER_SIZE( m, kkSize ); m.clear(); - EXPECT_TRUE( m.empty() ); + EXPECT_TRUE( m.empty()); EXPECT_CONTAINER_SIZE( m, 0 ); } }; diff --git a/test/unit/map/test_michael_iterable_hp.h b/test/unit/map/test_michael_iterable_hp.h index eecc1156..f8f2e867 100644 --- a/test/unit/map/test_michael_iterable_hp.h +++ b/test/unit/map/test_michael_iterable_hp.h @@ -67,8 +67,8 @@ namespace cds_test { } for ( auto const& i : arrKeys ) - EXPECT_TRUE( m.insert( i ) ); - EXPECT_FALSE( m.empty() ); + EXPECT_TRUE( m.insert( i )); + EXPECT_FALSE( m.empty()); EXPECT_CONTAINER_SIZE( m, kkSize ); // iterators @@ -128,10 +128,10 @@ namespace cds_test { ASSERT_TRUE( !gp ); gp = m.get( i ); ASSERT_TRUE( !gp ); - gp = m.get_with( other_item( i.nKey ), other_less() ); + gp = m.get_with( other_item( i.nKey ), other_less()); ASSERT_TRUE( !gp ); } - EXPECT_TRUE( m.empty() ); + EXPECT_TRUE( m.empty()); EXPECT_CONTAINER_SIZE( m, 0u ); } }; diff --git a/test/unit/map/test_skiplist_hp.h b/test/unit/map/test_skiplist_hp.h index 9c99762b..b3a53f85 100644 --- a/test/unit/map/test_skiplist_hp.h +++ b/test/unit/map/test_skiplist_hp.h @@ -59,8 +59,8 @@ namespace cds_test { shuffle( arrKeys.begin(), arrKeys.end()); for ( auto const& i : arrKeys ) - ASSERT_TRUE( m.insert( i ) ); - ASSERT_FALSE( m.empty() ); + ASSERT_TRUE( m.insert( i )); + ASSERT_FALSE( m.empty()); ASSERT_CONTAINER_SIZE( m, kkSize ); // extract_min @@ -69,33 +69,33 @@ namespace cds_test { int nKey = -1; size_t nCount = 0; - while ( !m.empty() ) { + while ( !m.empty()) { gp = m.extract_min(); ASSERT_FALSE( !gp ); EXPECT_EQ( gp->first.nKey, nKey + 1 ); nKey = gp->first.nKey; ++nCount; } - ASSERT_TRUE( m.empty() ); + ASSERT_TRUE( m.empty()); ASSERT_CONTAINER_SIZE( m, 0 ); EXPECT_EQ( nCount, kkSize ); // extract_max for ( auto const& i : arrKeys ) - ASSERT_TRUE( m.insert( i ) ); - ASSERT_FALSE( m.empty() ); + ASSERT_TRUE( m.insert( i )); + ASSERT_FALSE( m.empty()); ASSERT_CONTAINER_SIZE( m, kkSize ); nKey = kkSize; nCount = 0; - while ( !m.empty() ) { + while ( !m.empty()) { gp = m.extract_max(); ASSERT_FALSE( !gp ); EXPECT_EQ( gp->first.nKey, nKey - 1 ); nKey = gp->first.nKey; ++nCount; } - ASSERT_TRUE( m.empty() ); + ASSERT_TRUE( m.empty()); ASSERT_CONTAINER_SIZE( m, 0 ); EXPECT_EQ( nCount, kkSize ); } diff --git a/test/unit/map/test_skiplist_rcu.h b/test/unit/map/test_skiplist_rcu.h index 6ef2234f..63978e13 100644 --- a/test/unit/map/test_skiplist_rcu.h +++ b/test/unit/map/test_skiplist_rcu.h @@ -51,7 +51,7 @@ protected: base_class::test( m ); - ASSERT_TRUE( m.empty() ); + ASSERT_TRUE( m.empty()); ASSERT_CONTAINER_SIZE( m, 0 ); typedef typename Map::exempt_ptr exempt_ptr; @@ -65,7 +65,7 @@ protected: size_t nCount = 0; int nKey = 0; - while ( !m.empty() ) { + while ( !m.empty()) { xp = m.extract_min(); ASSERT_FALSE( !xp ); EXPECT_EQ( xp->first.nKey, nKey + 1 ); @@ -77,7 +77,7 @@ protected: xp = m.extract_max(); ASSERT_TRUE( !xp ); EXPECT_EQ( kkSize, nCount ); - ASSERT_TRUE( m.empty() ); + ASSERT_TRUE( m.empty()); ASSERT_CONTAINER_SIZE( m, 0 ); // get_max @@ -86,7 +86,7 @@ protected: nKey = kkSize; nCount = 0; - while ( !m.empty() ) { + while ( !m.empty()) { xp = m.extract_max(); ASSERT_FALSE( !xp ); EXPECT_EQ( xp->first.nKey, nKey - 1 ); @@ -98,7 +98,7 @@ protected: xp = m.extract_max(); ASSERT_TRUE( !xp ); EXPECT_EQ( kkSize, nCount ); - ASSERT_TRUE( m.empty() ); + ASSERT_TRUE( m.empty()); ASSERT_CONTAINER_SIZE( m, 0 ); } diff --git a/test/unit/misc/cxx11_atomic_class.cpp b/test/unit/misc/cxx11_atomic_class.cpp index 762f9379..8102d355 100644 --- a/test/unit/misc/cxx11_atomic_class.cpp +++ b/test/unit/misc/cxx11_atomic_class.cpp @@ -42,7 +42,7 @@ namespace { atomics::memory_order mo_clear = convert_to_store_order(order); for ( int i = 0; i < 5; ++i ) { EXPECT_TRUE( !f.test_and_set( order )); - EXPECT_TRUE( f.test_and_set( order ) ); + EXPECT_TRUE( f.test_and_set( order )); f.clear( mo_clear ); } } @@ -54,7 +54,7 @@ namespace { for ( int i = 0; i < 5; ++i ) { EXPECT_TRUE( !f.test_and_set()); - EXPECT_TRUE( f.test_and_set() ); + EXPECT_TRUE( f.test_and_set()); f.clear(); } @@ -71,7 +71,7 @@ namespace { { typedef Integral integral_type; - EXPECT_TRUE( a.is_lock_free() ); + EXPECT_TRUE( a.is_lock_free()); a.store( (integral_type) 0 ); EXPECT_EQ( a, static_cast( 0 )); EXPECT_EQ( a.load(), static_cast( 0 )); @@ -218,7 +218,7 @@ namespace { const atomics::memory_order oLoad = convert_to_load_order( order ); const atomics::memory_order oStore = convert_to_store_order( order ); - EXPECT_TRUE( a.is_lock_free() ); + EXPECT_TRUE( a.is_lock_free()); a.store((integral_type) 0, oStore ); EXPECT_EQ( a, integral_type( 0 )); EXPECT_EQ( a.load( oLoad ), integral_type( 0 )); @@ -355,7 +355,7 @@ namespace { template void do_test_atomic_bool( AtomicBool& a ) { - EXPECT_TRUE( a.is_lock_free() ); + EXPECT_TRUE( a.is_lock_free()); a.store( false ); EXPECT_FALSE( a ); EXPECT_FALSE( a.load()); @@ -370,7 +370,7 @@ namespace { EXPECT_FALSE( expected ); EXPECT_FALSE( a.compare_exchange_weak( expected, false)); EXPECT_TRUE( expected ); - EXPECT_TRUE( a.load() ); + EXPECT_TRUE( a.load()); a.store( false ); @@ -392,7 +392,7 @@ namespace { const atomics::memory_order oStore = convert_to_store_order( order ); const atomics::memory_order oExchange = convert_to_exchange_order( order ); - EXPECT_TRUE( a.is_lock_free() ); + EXPECT_TRUE( a.is_lock_free()); a.store( false, oStore ); EXPECT_FALSE( a ); EXPECT_FALSE( a.load( oLoad )); @@ -484,14 +484,14 @@ namespace { EXPECT_EQ( *reinterpret_cast(a.load()), 1 ); p = arr; - EXPECT_TRUE( a.compare_exchange_weak( p, (void *)(arr + 5) )); + EXPECT_TRUE( a.compare_exchange_weak( p, (void *)(arr + 5))); EXPECT_EQ( p, arr + 0 ); - EXPECT_FALSE( a.compare_exchange_weak( p, (void *)(arr + 3) )); + EXPECT_FALSE( a.compare_exchange_weak( p, (void *)(arr + 3))); EXPECT_EQ( p, arr + 5 ); - EXPECT_TRUE( a.compare_exchange_strong( p, (void *)(arr + 3) )); + EXPECT_TRUE( a.compare_exchange_strong( p, (void *)(arr + 3))); EXPECT_EQ( p, arr + 5 ); - EXPECT_FALSE( a.compare_exchange_strong( p, (void *)(arr + 5) )); + EXPECT_FALSE( a.compare_exchange_strong( p, (void *)(arr + 5))); EXPECT_EQ( p, arr + 3 ); EXPECT_EQ( reinterpret_cast( a.exchange( (void *) arr )), arr + 3 ); diff --git a/test/unit/misc/cxx11_atomic_func.cpp b/test/unit/misc/cxx11_atomic_func.cpp index 985dc4f5..4f7255de 100644 --- a/test/unit/misc/cxx11_atomic_func.cpp +++ b/test/unit/misc/cxx11_atomic_func.cpp @@ -47,11 +47,11 @@ namespace misc { { atomics::memory_order mo_clear = convert_to_store_order(order); - f.clear( convert_to_store_order(order) ); + f.clear( convert_to_store_order(order)); for ( int i = 0; i < 5; ++i ) { EXPECT_FALSE( atomics::atomic_flag_test_and_set_explicit( &f, order )); - EXPECT_TRUE( atomics::atomic_flag_test_and_set_explicit( &f, order ) ); + EXPECT_TRUE( atomics::atomic_flag_test_and_set_explicit( &f, order )); atomics::atomic_flag_clear_explicit( &f, mo_clear ); atomics::atomic_flag_clear_explicit( &f, mo_clear ); } @@ -64,7 +64,7 @@ namespace misc { for ( int i = 0; i < 5; ++i ) { EXPECT_FALSE( atomics::atomic_flag_test_and_set( &f )); - EXPECT_TRUE( atomics::atomic_flag_test_and_set( &f ) ); + EXPECT_TRUE( atomics::atomic_flag_test_and_set( &f )); atomics::atomic_flag_clear(&f); atomics::atomic_flag_clear(&f); } @@ -81,7 +81,7 @@ namespace misc { { typedef Integral integral_type; - EXPECT_TRUE( atomics::atomic_is_lock_free( &a ) ); + EXPECT_TRUE( atomics::atomic_is_lock_free( &a )); atomics::atomic_store( &a, (integral_type) 0 ); EXPECT_EQ( a, integral_type( 0 )); EXPECT_EQ( atomics::atomic_load( &a ), integral_type( 0 )); @@ -102,7 +102,7 @@ namespace misc { EXPECT_TRUE( atomics::atomic_compare_exchange_weak( &a, &expected, n)); EXPECT_EQ( expected, prev ); EXPECT_NE( expected, n ); - EXPECT_FALSE( atomics::atomic_compare_exchange_weak( &a, &expected, n) ); + EXPECT_FALSE( atomics::atomic_compare_exchange_weak( &a, &expected, n)); EXPECT_EQ( expected, n ); prev = n; @@ -186,7 +186,7 @@ namespace misc { const atomics::memory_order oLoad = convert_to_load_order( order ); const atomics::memory_order oStore = convert_to_store_order( order ); - EXPECT_TRUE( atomics::atomic_is_lock_free( &a ) ); + EXPECT_TRUE( atomics::atomic_is_lock_free( &a )); atomics::atomic_store_explicit( &a, (integral_type) 0, oStore ); EXPECT_EQ( a, integral_type( 0 )); EXPECT_EQ( atomics::atomic_load_explicit( &a, oLoad ), (integral_type) 0 ); @@ -318,7 +318,7 @@ namespace misc { template void do_test_atomic_bool(AtomicBool& a) { - EXPECT_TRUE( atomics::atomic_is_lock_free( &a ) ); + EXPECT_TRUE( atomics::atomic_is_lock_free( &a )); atomics::atomic_store( &a, false ); EXPECT_FALSE( a ); EXPECT_FALSE( atomics::atomic_load( &a )); @@ -355,7 +355,7 @@ namespace misc { const atomics::memory_order oStore = convert_to_store_order( order ); const atomics::memory_order oExchange = convert_to_exchange_order( order ); - EXPECT_TRUE( atomics::atomic_is_lock_free( &a ) ); + EXPECT_TRUE( atomics::atomic_is_lock_free( &a )); atomics::atomic_store_explicit( &a, false, oStore ); EXPECT_FALSE( a == false ); EXPECT_FALSE( atomics::atomic_load_explicit( &a, oLoad )); @@ -545,14 +545,14 @@ namespace misc { EXPECT_EQ( *reinterpret_cast(atomics::atomic_load( &a )), 1 ); p = arr; - EXPECT_TRUE( atomics::atomic_compare_exchange_weak( &a, (void **) &p, (void *)(arr + 5) )); + EXPECT_TRUE( atomics::atomic_compare_exchange_weak( &a, (void **) &p, (void *)(arr + 5))); EXPECT_EQ( p, arr + 0 ); - EXPECT_FALSE( atomics::atomic_compare_exchange_weak( &a, (void **) &p, (void *)(arr + 3) )); + EXPECT_FALSE( atomics::atomic_compare_exchange_weak( &a, (void **) &p, (void *)(arr + 3))); EXPECT_EQ( p, arr + 5 ); - EXPECT_TRUE( atomics::atomic_compare_exchange_strong( &a, (void **) &p, (void *)(arr + 3) )); + EXPECT_TRUE( atomics::atomic_compare_exchange_strong( &a, (void **) &p, (void *)(arr + 3))); EXPECT_EQ( p, arr + 5 ); - EXPECT_FALSE( atomics::atomic_compare_exchange_strong( &a, (void **) &p, (void *)(arr + 5) )); + EXPECT_FALSE( atomics::atomic_compare_exchange_strong( &a, (void **) &p, (void *)(arr + 5))); EXPECT_EQ( p, arr + 3 ); EXPECT_EQ( reinterpret_cast( atomics::atomic_exchange( &a, (void *) arr )), arr + 3 ); diff --git a/test/unit/misc/permutation_generator.cpp b/test/unit/misc/permutation_generator.cpp index 6a59cb99..bba58f31 100644 --- a/test/unit/misc/permutation_generator.cpp +++ b/test/unit/misc/permutation_generator.cpp @@ -49,7 +49,7 @@ namespace { do { typename Gen::integer_type i = gen; ++arr[ i ]; - } while ( gen.next() ); + } while ( gen.next()); for ( size_t i = 0; i < nLen; ++i ) EXPECT_EQ( arr[i], 1u ) << "i=" << i; diff --git a/test/unit/misc/split_bitstring.cpp b/test/unit/misc/split_bitstring.cpp index fb413adb..ffb11acc 100644 --- a/test/unit/misc/split_bitstring.cpp +++ b/test/unit/misc/split_bitstring.cpp @@ -55,34 +55,34 @@ namespace { size_t res; // Trivial case - ASSERT_FALSE( splitter.eos() ); + ASSERT_FALSE( splitter.eos()); ASSERT_FALSE( !splitter ); res = splitter.cut(sizeof(src) * 8); EXPECT_EQ( res, src ); - ASSERT_TRUE( splitter.eos() ); + ASSERT_TRUE( splitter.eos()); ASSERT_TRUE( !splitter ); EXPECT_EQ(splitter.safe_cut(sizeof(src) * 8), 0u ); - ASSERT_TRUE( splitter.eos() ); + ASSERT_TRUE( splitter.eos()); ASSERT_TRUE( !splitter ); splitter.reset(); - ASSERT_FALSE( splitter.eos() ); + ASSERT_FALSE( splitter.eos()); ASSERT_FALSE( !splitter ); res = splitter.cut(sizeof(src) * 8); EXPECT_EQ( res, src ); - ASSERT_TRUE( splitter.eos() ); + ASSERT_TRUE( splitter.eos()); ASSERT_TRUE( !splitter ); EXPECT_EQ( splitter.safe_cut(sizeof(src) * 8), 0u ); - ASSERT_TRUE( splitter.eos() ); + ASSERT_TRUE( splitter.eos()); ASSERT_TRUE( !splitter ); // Cut each hex digit splitter.reset(); for ( size_t i = 0; i < sizeof(size_t) * 2; ++i ) { - ASSERT_FALSE( splitter.eos() ); + ASSERT_FALSE( splitter.eos()); ASSERT_FALSE( !splitter ); ASSERT_EQ( splitter.cut( 4 ), i ); } - ASSERT_TRUE( splitter.eos() ); + ASSERT_TRUE( splitter.eos()); ASSERT_FALSE( splitter ); // by one bit @@ -90,11 +90,11 @@ namespace { splitter.reset(); res = 0; for ( size_t i = 0; i < sizeof(size_t) * 8; ++i ) { - ASSERT_FALSE( splitter.eos() ); + ASSERT_FALSE( splitter.eos()); ASSERT_FALSE( !splitter ); res = res + (splitter.cut( 1 ) << i); } - ASSERT_TRUE( splitter.eos() ); + ASSERT_TRUE( splitter.eos()); ASSERT_TRUE( !splitter ); EXPECT_EQ( res, src ); } @@ -106,13 +106,13 @@ namespace { res = 0; size_t shift = 0; while ( splitter ) { - ASSERT_FALSE( splitter.eos() ); + ASSERT_FALSE( splitter.eos()); ASSERT_FALSE( !splitter ); int bits = std::rand() % 16; res = res + ( splitter.safe_cut( bits ) << shift ); shift += bits; } - ASSERT_TRUE( splitter.eos() ); + ASSERT_TRUE( splitter.eos()); ASSERT_TRUE( !splitter ); EXPECT_EQ( res, src ); } @@ -128,34 +128,34 @@ namespace { size_t res; // Trivial case - ASSERT_FALSE( splitter.eos() ); + ASSERT_FALSE( splitter.eos()); ASSERT_FALSE( !splitter ); res = splitter.cut(sizeof(src) * 8); ASSERT_EQ( res, src ); - ASSERT_TRUE( splitter.eos() ); + ASSERT_TRUE( splitter.eos()); ASSERT_TRUE( !splitter ); EXPECT_EQ(splitter.safe_cut(sizeof(src) * 8), 0u ); - ASSERT_TRUE( splitter.eos() ); + ASSERT_TRUE( splitter.eos()); ASSERT_TRUE( !splitter ); splitter.reset(); - ASSERT_FALSE( splitter.eos() ); + ASSERT_FALSE( splitter.eos()); ASSERT_FALSE( !splitter ); res = splitter.cut(sizeof(src) * 8); EXPECT_EQ( res, src ); - ASSERT_TRUE( splitter.eos() ); + ASSERT_TRUE( splitter.eos()); ASSERT_TRUE( !splitter ); EXPECT_EQ(splitter.safe_cut(sizeof(src) * 8), 0u ); - ASSERT_TRUE( splitter.eos() ); + ASSERT_TRUE( splitter.eos()); ASSERT_TRUE( !splitter ); // Cut each hex digit splitter.reset(); for ( size_t i = 0; i < sizeof(size_t) * 2; ++i ) { - ASSERT_FALSE( splitter.eos() ); + ASSERT_FALSE( splitter.eos()); ASSERT_FALSE( !splitter ); EXPECT_EQ( splitter.cut( 4 ), 0x0F - i ); } - ASSERT_TRUE( splitter.eos() ); + ASSERT_TRUE( splitter.eos()); ASSERT_TRUE( !splitter ); // by one bit @@ -163,11 +163,11 @@ namespace { splitter.reset(); res = 0; for ( size_t i = 0; i < sizeof(size_t) * 8; ++i ) { - ASSERT_FALSE( splitter.eos() ); + ASSERT_FALSE( splitter.eos()); ASSERT_FALSE( !splitter ); res = (res << 1) + splitter.cut( 1 ); } - ASSERT_TRUE( splitter.eos() ); + ASSERT_TRUE( splitter.eos()); ASSERT_TRUE( !splitter ); EXPECT_EQ( res, src ); } @@ -178,12 +178,12 @@ namespace { splitter.reset(); res = 0; while ( splitter ) { - ASSERT_FALSE( splitter.eos() ); + ASSERT_FALSE( splitter.eos()); ASSERT_FALSE( !splitter ); int bits = std::rand() % 16; res = (res << bits) + splitter.safe_cut( bits ); } - ASSERT_TRUE( splitter.eos() ); + ASSERT_TRUE( splitter.eos()); ASSERT_TRUE( !splitter ); EXPECT_EQ( res, src ); } @@ -204,11 +204,11 @@ namespace { // Cut each hex digit splitter.reset(); for ( size_t i = 0; i < sizeof(size_t) * 2; ++i ) { - ASSERT_FALSE( splitter.eos() ); + ASSERT_FALSE( splitter.eos()); ASSERT_FALSE( !splitter ); EXPECT_EQ( static_cast(splitter.cut( 4 )), i ); } - ASSERT_TRUE( splitter.eos() ); + ASSERT_TRUE( splitter.eos()); ASSERT_TRUE( !splitter ); // by one bit @@ -216,11 +216,11 @@ namespace { splitter.reset(); res = 0; for ( size_t i = 0; i < sizeof(size_t) * 8; ++i ) { - ASSERT_FALSE( splitter.eos() ); + ASSERT_FALSE( splitter.eos()); ASSERT_FALSE( !splitter ); res = res + ( static_cast(splitter.cut( 1 )) << i); } - ASSERT_TRUE( splitter.eos() ); + ASSERT_TRUE( splitter.eos()); ASSERT_TRUE( !splitter ); EXPECT_EQ( res, src ); } @@ -232,13 +232,13 @@ namespace { res = 0; size_t shift = 0; while ( splitter ) { - ASSERT_FALSE( splitter.eos() ); + ASSERT_FALSE( splitter.eos()); ASSERT_FALSE( !splitter ); int bits = std::rand() % 16; res = res + ( static_cast(splitter.safe_cut( bits )) << shift ); shift += bits; } - ASSERT_TRUE( splitter.eos() ); + ASSERT_TRUE( splitter.eos()); ASSERT_TRUE( !splitter ); EXPECT_EQ( res, src ); } @@ -259,11 +259,11 @@ namespace { // Cut each hex digit splitter.reset(); for ( size_t i = 0; i < sizeof(size_t) * 2; ++i ) { - ASSERT_FALSE( splitter.eos() ); + ASSERT_FALSE( splitter.eos()); ASSERT_FALSE( !splitter ); EXPECT_EQ( splitter.cut( 4 ), 0x0F - i ); } - ASSERT_TRUE( splitter.eos() ); + ASSERT_TRUE( splitter.eos()); ASSERT_TRUE( !splitter ); // by one bit @@ -271,11 +271,11 @@ namespace { splitter.reset(); res = 0; for ( size_t i = 0; i < sizeof(size_t) * 8; ++i ) { - ASSERT_FALSE( splitter.eos() ); + ASSERT_FALSE( splitter.eos()); ASSERT_FALSE( !splitter ); res = (res << 1) + splitter.cut( 1 ); } - ASSERT_TRUE( splitter.eos() ); + ASSERT_TRUE( splitter.eos()); ASSERT_TRUE( !splitter ); EXPECT_EQ( res, src ); } @@ -286,12 +286,12 @@ namespace { splitter.reset(); res = 0; while ( splitter ) { - ASSERT_FALSE( splitter.eos() ); + ASSERT_FALSE( splitter.eos()); ASSERT_FALSE( !splitter ); int bits = std::rand() % 16; res = (res << bits) + splitter.safe_cut( bits ); } - ASSERT_TRUE( splitter.eos() ); + ASSERT_TRUE( splitter.eos()); ASSERT_TRUE( !splitter ); EXPECT_EQ( res, src ); } @@ -301,7 +301,7 @@ namespace { TEST_F( Split_bitstrig, cut_uint ) { - if ( is_big_endian() ) + if ( is_big_endian()) cut_uint_be(); else cut_uint_le(); @@ -309,7 +309,7 @@ namespace { TEST_F( Split_bitstrig, cut_uint16 ) { - if ( is_big_endian() ) + if ( is_big_endian()) cut_small_be(); else cut_small_le(); diff --git a/test/unit/pqueue/intrusive_mspqueue.cpp b/test/unit/pqueue/intrusive_mspqueue.cpp index 3bed9dda..6c8cdae3 100644 --- a/test/unit/pqueue/intrusive_mspqueue.cpp +++ b/test/unit/pqueue/intrusive_mspqueue.cpp @@ -54,12 +54,12 @@ namespace { template void test( PQueue& pq ) { - data_array arr( pq.capacity() ); + data_array arr( pq.capacity()); value_type * pFirst = arr.begin(); value_type * pLast = arr.end(); - ASSERT_TRUE( pq.empty() ); - ASSERT_FALSE( pq.full() ); + ASSERT_TRUE( pq.empty()); + ASSERT_FALSE( pq.full()); ASSERT_EQ( pq.size(), 0u ); ASSERT_EQ( pq.capacity(), static_cast( base_class::c_nCapacity - 1 )); @@ -67,31 +67,31 @@ namespace { // Push test for ( value_type * p = pFirst; p < pLast; ++p ) { - ASSERT_TRUE( pq.push( *p ) ); - ASSERT_FALSE( pq.empty() ); + ASSERT_TRUE( pq.push( *p )); + ASSERT_FALSE( pq.empty()); ASSERT_EQ( pq.size(), ++nSize ); } - ASSERT_TRUE( pq.full() ); - ASSERT_EQ( pq.size(), pq.capacity() ); + ASSERT_TRUE( pq.full()); + ASSERT_EQ( pq.size(), pq.capacity()); // The queue is full { value_type k( base_class::c_nMinValue + key_type( base_class::c_nCapacity )); - ASSERT_FALSE( pq.push( k ) ); - ASSERT_TRUE( pq.full() ); - ASSERT_EQ( pq.size(), pq.capacity() ); + ASSERT_FALSE( pq.push( k )); + ASSERT_TRUE( pq.full()); + ASSERT_EQ( pq.size(), pq.capacity()); } // Pop test - key_type nPrev = base_class::c_nMinValue + key_type( pq.capacity() ) - 1; + key_type nPrev = base_class::c_nMinValue + key_type( pq.capacity()) - 1; value_type * p = pq.pop(); ASSERT_TRUE( p != nullptr ); EXPECT_EQ( p->k, nPrev ); ASSERT_EQ( pq.size(), pq.capacity() - 1 ); - ASSERT_FALSE( pq.full() ); - ASSERT_FALSE( pq.empty() ); + ASSERT_FALSE( pq.full()); + ASSERT_FALSE( pq.empty()); nSize = pq.size(); while ( pq.size() > 1u ) { @@ -103,45 +103,45 @@ namespace { ASSERT_EQ( pq.size(), nSize ); } - ASSERT_FALSE( pq.full() ); - ASSERT_FALSE( pq.empty() ); + ASSERT_FALSE( pq.full()); + ASSERT_FALSE( pq.empty()); ASSERT_EQ( pq.size(), 1u ); p = pq.pop(); ASSERT_TRUE( p != nullptr ); EXPECT_EQ( p->k, base_class::c_nMinValue ); - ASSERT_FALSE( pq.full() ); - ASSERT_TRUE( pq.empty() ); + ASSERT_FALSE( pq.full()); + ASSERT_TRUE( pq.empty()); ASSERT_EQ( pq.size(), 0u ); // Clear test for ( value_type * p = pFirst; p < pLast; ++p ) { - ASSERT_TRUE( pq.push( *p ) ); + ASSERT_TRUE( pq.push( *p )); } - EXPECT_FALSE( pq.empty() ); - EXPECT_TRUE( pq.full() ); - EXPECT_EQ( pq.size(), pq.capacity() ); + EXPECT_FALSE( pq.empty()); + EXPECT_TRUE( pq.full()); + EXPECT_EQ( pq.size(), pq.capacity()); pq.clear(); - EXPECT_TRUE( pq.empty() ); - EXPECT_FALSE( pq.full() ); + EXPECT_TRUE( pq.empty()); + EXPECT_FALSE( pq.full()); EXPECT_EQ( pq.size(), 0u ); // clear_with test for ( value_type * p = pFirst; p < pLast; ++p ) { - ASSERT_TRUE( pq.push( *p ) ); + ASSERT_TRUE( pq.push( *p )); } - ASSERT_FALSE( pq.empty() ); - ASSERT_TRUE( pq.full() ); - ASSERT_EQ( pq.size(), pq.capacity() ); + ASSERT_FALSE( pq.empty()); + ASSERT_TRUE( pq.full()); + ASSERT_EQ( pq.size(), pq.capacity()); { disposer disp; - pq.clear_with( std::ref( disp ) ); - ASSERT_TRUE( pq.empty() ); - ASSERT_FALSE( pq.full() ); + pq.clear_with( std::ref( disp )); + ASSERT_TRUE( pq.empty()); + ASSERT_FALSE( pq.full()); ASSERT_EQ( pq.size(), 0u ); - ASSERT_EQ( disp.m_nCallCount, pq.capacity() ); + ASSERT_EQ( disp.m_nCallCount, pq.capacity()); } } }; @@ -236,7 +236,7 @@ namespace { >::type > pqueue; - std::unique_ptr pq( new pqueue( 0 ) ); + std::unique_ptr pq( new pqueue( 0 )); test( *pq ); } @@ -249,7 +249,7 @@ namespace { >::type > pqueue; - std::unique_ptr pq( new pqueue( 0 ) ); + std::unique_ptr pq( new pqueue( 0 )); test( *pq ); } @@ -263,7 +263,7 @@ namespace { }; typedef cds::intrusive::MSPriorityQueue< value_type, traits > pqueue; - std::unique_ptr pq( new pqueue( 0 ) ); + std::unique_ptr pq( new pqueue( 0 )); test( *pq ); } diff --git a/test/unit/pqueue/mspqueue.cpp b/test/unit/pqueue/mspqueue.cpp index 2f22c791..e378e42c 100644 --- a/test/unit/pqueue/mspqueue.cpp +++ b/test/unit/pqueue/mspqueue.cpp @@ -54,11 +54,11 @@ namespace { template void test( PQueue& pq ) { - data_array arr( pq.capacity() ); + data_array arr( pq.capacity()); value_type * pFirst = arr.begin(); value_type * pLast = pFirst + pq.capacity(); - ASSERT_TRUE( pq.empty() ); + ASSERT_TRUE( pq.empty()); ASSERT_EQ( pq.size(), 0u ); ASSERT_EQ( pq.capacity(), size_t( base_class::c_nCapacity - 1 )); @@ -68,50 +68,50 @@ namespace { for ( value_type * p = pFirst; p < pLast; ++p ) { switch ( pq.size() & 3 ) { case 0: - ASSERT_TRUE( pq.push_with( [p]( value_type& dest ) { dest = *p; } ) ); + ASSERT_TRUE( pq.push_with( [p]( value_type& dest ) { dest = *p; } )); break; case 1: - ASSERT_TRUE( pq.emplace( p->k, p->v ) ); + ASSERT_TRUE( pq.emplace( p->k, p->v )); break; case 2: - ASSERT_TRUE( pq.emplace( std::make_pair( p->k, p->v ) ) ); + ASSERT_TRUE( pq.emplace( std::make_pair( p->k, p->v )) ); break; default: - ASSERT_TRUE( pq.push( *p ) ); + ASSERT_TRUE( pq.push( *p )); } - ASSERT_TRUE( !pq.empty() ); + ASSERT_TRUE( !pq.empty()); ASSERT_TRUE( pq.size() == ++nSize ); } - ASSERT_TRUE( pq.full() ); - ASSERT_EQ( pq.size(), pq.capacity() ); + ASSERT_TRUE( pq.full()); + ASSERT_EQ( pq.size(), pq.capacity()); // The queue is full key_type k = base_class::c_nMinValue + key_type( base_class::c_nCapacity ); - ASSERT_TRUE( !pq.push( k ) ); - ASSERT_TRUE( pq.full() ); - ASSERT_EQ( pq.size(), pq.capacity() ); + ASSERT_TRUE( !pq.push( k )); + ASSERT_TRUE( pq.full()); + ASSERT_EQ( pq.size(), pq.capacity()); // Pop test - key_type nPrev = base_class::c_nMinValue + key_type( pq.capacity() ) - 1; + key_type nPrev = base_class::c_nMinValue + key_type( pq.capacity()) - 1; value_type kv( 0 ); key_type key; - ASSERT_TRUE( pq.pop( kv ) ); + ASSERT_TRUE( pq.pop( kv )); EXPECT_EQ( kv.k, nPrev ); ASSERT_EQ( pq.size(), pq.capacity() - 1 ); - ASSERT_TRUE( !pq.full() ); - ASSERT_TRUE( !pq.empty() ); + ASSERT_TRUE( !pq.full()); + ASSERT_TRUE( !pq.empty()); nSize = pq.size(); while ( pq.size() > 1 ) { if ( pq.size() & 1 ) { - ASSERT_TRUE( pq.pop( kv ) ); + ASSERT_TRUE( pq.pop( kv )); EXPECT_EQ( kv.k, nPrev - 1 ); nPrev = kv.k; } else { - ASSERT_TRUE( pq.pop_with( [&key]( value_type& src ) { key = src.k; } ) ); + ASSERT_TRUE( pq.pop_with( [&key]( value_type& src ) { key = src.k; } )); EXPECT_EQ( key, nPrev - 1 ); nPrev = key; } @@ -120,44 +120,44 @@ namespace { ASSERT_EQ( pq.size(), nSize ); } - ASSERT_TRUE( !pq.full() ); - ASSERT_TRUE( !pq.empty() ); + ASSERT_TRUE( !pq.full()); + ASSERT_TRUE( !pq.empty()); ASSERT_EQ( pq.size(), 1u ); - ASSERT_TRUE( pq.pop( kv ) ); + ASSERT_TRUE( pq.pop( kv )); EXPECT_EQ( kv.k, base_class::c_nMinValue ); - ASSERT_TRUE( !pq.full() ); - ASSERT_TRUE( pq.empty() ); + ASSERT_TRUE( !pq.full()); + ASSERT_TRUE( pq.empty()); ASSERT_EQ( pq.size(), 0u ); // Clear test for ( value_type * p = pFirst; p < pLast; ++p ) { - ASSERT_TRUE( pq.push( *p ) ); + ASSERT_TRUE( pq.push( *p )); } - ASSERT_TRUE( !pq.empty() ); - ASSERT_TRUE( pq.full() ); - ASSERT_EQ( pq.size(), pq.capacity() ); + ASSERT_TRUE( !pq.empty()); + ASSERT_TRUE( pq.full()); + ASSERT_EQ( pq.size(), pq.capacity()); pq.clear(); - ASSERT_TRUE( pq.empty() ); - ASSERT_TRUE( !pq.full() ); + ASSERT_TRUE( pq.empty()); + ASSERT_TRUE( !pq.full()); ASSERT_EQ( pq.size(), 0u ); // clear_with test for ( value_type * p = pFirst; p < pLast; ++p ) { - ASSERT_TRUE( pq.push( *p ) ); + ASSERT_TRUE( pq.push( *p )); } - ASSERT_TRUE( !pq.empty() ); - ASSERT_TRUE( pq.full() ); - ASSERT_EQ( pq.size(), pq.capacity() ); + ASSERT_TRUE( !pq.empty()); + ASSERT_TRUE( pq.full()); + ASSERT_EQ( pq.size(), pq.capacity()); { disposer disp; - pq.clear_with( std::ref( disp ) ); - ASSERT_TRUE( pq.empty() ); - ASSERT_TRUE( !pq.full() ); + pq.clear_with( std::ref( disp )); + ASSERT_TRUE( pq.empty()); + ASSERT_TRUE( !pq.full()); ASSERT_EQ( pq.size(), 0u ); - ASSERT_EQ( disp.m_nCallCount, pq.capacity() ); + ASSERT_EQ( disp.m_nCallCount, pq.capacity()); } } }; diff --git a/test/unit/pqueue/test_fcpqueue.h b/test/unit/pqueue/test_fcpqueue.h index 20468a04..2edad90a 100644 --- a/test/unit/pqueue/test_fcpqueue.h +++ b/test/unit/pqueue/test_fcpqueue.h @@ -45,15 +45,15 @@ namespace cds_test { value_type * pFirst = arr.begin(); value_type * pLast = arr.end(); - ASSERT_TRUE( pq.empty() ); + ASSERT_TRUE( pq.empty()); ASSERT_TRUE( pq.size() == 0 ); size_t nSize = 0; // Push test for ( value_type * p = pFirst; p < pLast; ++p ) { - ASSERT_TRUE( pq.push( *p ) ); - ASSERT_TRUE( !pq.empty() ); + ASSERT_TRUE( pq.push( *p )); + ASSERT_TRUE( !pq.empty()); ASSERT_EQ( pq.size(), ++nSize ); } @@ -63,15 +63,15 @@ namespace cds_test { key_type nPrev = PQueueTest::c_nMinValue + key_type( PQueueTest::c_nCapacity ) - 1; value_type kv( 0 ); - ASSERT_TRUE( pq.pop( kv ) ); + ASSERT_TRUE( pq.pop( kv )); EXPECT_EQ( kv.k, nPrev ); ASSERT_EQ( pq.size(), static_cast( PQueueTest::c_nCapacity - 1 )); - ASSERT_TRUE( !pq.empty() ); + ASSERT_TRUE( !pq.empty()); nSize = pq.size(); while ( pq.size() > 1 ) { - ASSERT_TRUE( pq.pop( kv ) ); + ASSERT_TRUE( pq.pop( kv )); EXPECT_EQ( kv.k, nPrev - 1 ); nPrev = kv.k; @@ -79,13 +79,13 @@ namespace cds_test { ASSERT_EQ( pq.size(), nSize ); } - ASSERT_TRUE( !pq.empty() ); + ASSERT_TRUE( !pq.empty()); ASSERT_EQ( pq.size(), 1u ); - ASSERT_TRUE( pq.pop( kv ) ); + ASSERT_TRUE( pq.pop( kv )); EXPECT_EQ( kv.k, PQueueTest::c_nMinValue ); - ASSERT_TRUE( pq.empty() ); + ASSERT_TRUE( pq.empty()); ASSERT_EQ( pq.size(), 0u ); // pop from empty pqueue @@ -95,13 +95,13 @@ namespace cds_test { // Clear test for ( value_type * p = pFirst; p < pLast; ++p ) - ASSERT_TRUE( pq.push( *p ) ); + ASSERT_TRUE( pq.push( *p )); - ASSERT_TRUE( !pq.empty() ); + ASSERT_TRUE( !pq.empty()); ASSERT_EQ( pq.size(), static_cast( PQueueTest::c_nCapacity )); pq.clear(); - ASSERT_TRUE( pq.empty() ); + ASSERT_TRUE( pq.empty()); ASSERT_EQ( pq.size(), 0u ); } }; diff --git a/test/unit/queue/fcqueue.cpp b/test/unit/queue/fcqueue.cpp index aa6b67af..432fb6ce 100644 --- a/test/unit/queue/fcqueue.cpp +++ b/test/unit/queue/fcqueue.cpp @@ -46,7 +46,7 @@ namespace { const size_t nSize = 100; - ASSERT_TRUE( q.empty() ); + ASSERT_TRUE( q.empty()); ASSERT_EQ( q.size(), 0u ); // enqueue/dequeue @@ -54,7 +54,7 @@ namespace { ASSERT_TRUE( q.enqueue( static_cast(i))); ASSERT_EQ( q.size(), i + 1 ); } - ASSERT_FALSE( q.empty() ); + ASSERT_FALSE( q.empty()); ASSERT_EQ( q.size(), nSize ); for ( size_t i = 0; i < nSize; ++i ) { @@ -63,7 +63,7 @@ namespace { ASSERT_EQ( it, static_cast( i )); ASSERT_EQ( q.size(), nSize - i - 1 ); } - ASSERT_TRUE( q.empty() ); + ASSERT_TRUE( q.empty()); ASSERT_EQ( q.size(), 0u ); // push/pop @@ -71,39 +71,39 @@ namespace { ASSERT_TRUE( q.push( static_cast(i))); ASSERT_EQ( q.size(), i + 1 ); } - ASSERT_FALSE( q.empty() ); + ASSERT_FALSE( q.empty()); ASSERT_EQ( q.size(), nSize ); for ( size_t i = 0; i < nSize; ++i ) { it = -1; - ASSERT_TRUE( q.pop( it ) ); + ASSERT_TRUE( q.pop( it )); ASSERT_EQ( it, static_cast( i )); ASSERT_EQ( q.size(), nSize - i - 1 ); } - ASSERT_TRUE( q.empty() ); + ASSERT_TRUE( q.empty()); ASSERT_EQ( q.size(), 0u ); // clear for ( size_t i = 0; i < nSize; ++i ) { ASSERT_TRUE( q.push( static_cast( i ))); } - ASSERT_FALSE( q.empty() ); + ASSERT_FALSE( q.empty()); ASSERT_EQ( q.size(), nSize ); q.clear(); - ASSERT_TRUE( q.empty() ); + ASSERT_TRUE( q.empty()); ASSERT_EQ( q.size(), 0u ); // pop from empty queue it = nSize * 2; ASSERT_FALSE( q.pop( it )); ASSERT_EQ( it, static_cast( nSize * 2 )); - ASSERT_TRUE( q.empty() ); + ASSERT_TRUE( q.empty()); ASSERT_EQ( q.size(), 0u ); - ASSERT_FALSE( q.dequeue( it ) ); + ASSERT_FALSE( q.dequeue( it )); ASSERT_EQ( it, static_cast( nSize * 2 )); - ASSERT_TRUE( q.empty() ); + ASSERT_TRUE( q.empty()); ASSERT_EQ( q.size(), 0u ); } @@ -124,7 +124,7 @@ namespace { ASSERT_FALSE( s.empty()); ASSERT_EQ( q.size(), i + 1 ); } - ASSERT_FALSE( q.empty() ); + ASSERT_FALSE( q.empty()); ASSERT_EQ( q.size(), nSize ); for ( size_t i = 0; i < nSize; ++i ) { @@ -133,7 +133,7 @@ namespace { ASSERT_EQ( q.size(), nSize - i - 1 ); ASSERT_EQ( s, str[i] ); } - ASSERT_TRUE( q.empty() ); + ASSERT_TRUE( q.empty()); ASSERT_EQ( q.size(), 0u ); } }; diff --git a/test/unit/queue/intrusive_fcqueue.cpp b/test/unit/queue/intrusive_fcqueue.cpp index f064bcba..e979b8c5 100644 --- a/test/unit/queue/intrusive_fcqueue.cpp +++ b/test/unit/queue/intrusive_fcqueue.cpp @@ -85,18 +85,18 @@ namespace { for ( size_t i = 0; i < nSize; ++i ) arr[i].nVal = static_cast(i); - ASSERT_TRUE( q.empty() ); + ASSERT_TRUE( q.empty()); ASSERT_EQ( q.size(), 0u ); // pop from empty queue pv = q.pop(); ASSERT_TRUE( pv == nullptr ); - ASSERT_TRUE( q.empty() ); + ASSERT_TRUE( q.empty()); ASSERT_EQ( q.size(), 0u ); pv = q.dequeue(); ASSERT_TRUE( pv == nullptr ); - ASSERT_TRUE( q.empty() ); + ASSERT_TRUE( q.empty()); ASSERT_EQ( q.size(), 0u ); // push/pop test @@ -105,21 +105,21 @@ namespace { q.push( arr[i] ); else q.enqueue( arr[i] ); - ASSERT_FALSE( q.empty() ); + ASSERT_FALSE( q.empty()); ASSERT_EQ( q.size(), i + 1 ); } for ( size_t i = 0; i < nSize; ++i ) { - ASSERT_FALSE( q.empty() ); + ASSERT_FALSE( q.empty()); ASSERT_EQ( q.size(), nSize - i ); if ( i & 1 ) pv = q.pop(); else pv = q.dequeue(); ASSERT_FALSE( pv == nullptr ); - ASSERT_EQ( pv->nVal, static_cast(i) ); + ASSERT_EQ( pv->nVal, static_cast(i)); } - ASSERT_TRUE( q.empty() ); + ASSERT_TRUE( q.empty()); ASSERT_EQ( q.size(), 0u ); // pop() doesn't call disposer @@ -131,11 +131,11 @@ namespace { for ( size_t i = 0; i < nSize; ++i ) q.push( arr[i] ); - ASSERT_FALSE( q.empty() ); + ASSERT_FALSE( q.empty()); ASSERT_EQ( q.size(), nSize ); q.clear( true ); - ASSERT_TRUE( q.empty() ); + ASSERT_TRUE( q.empty()); ASSERT_EQ( q.size(), 0u ); for ( size_t i = 0; i < nSize; ++i ) { @@ -147,7 +147,7 @@ namespace { q.push( arr[i] ); q.clear(); - ASSERT_TRUE( q.empty() ); + ASSERT_TRUE( q.empty()); ASSERT_EQ( q.size(), 0u ); for ( size_t i = 0; i < nSize; ++i ) { diff --git a/test/unit/queue/segmented_queue_dhp.cpp b/test/unit/queue/segmented_queue_dhp.cpp index e6239393..a76a00df 100644 --- a/test/unit/queue/segmented_queue_dhp.cpp +++ b/test/unit/queue/segmented_queue_dhp.cpp @@ -76,7 +76,7 @@ namespace { typedef cds::container::SegmentedQueue< gc_type, int, traits > test_queue; test_queue q( c_QuasiFactor ); - ASSERT_EQ( q.quasi_factor(), cds::beans::ceil2( c_QuasiFactor ) ); + ASSERT_EQ( q.quasi_factor(), cds::beans::ceil2( c_QuasiFactor )); test( q ); } @@ -90,7 +90,7 @@ namespace { typedef cds::container::SegmentedQueue< gc_type, int, traits > test_queue; test_queue q( c_QuasiFactor ); - ASSERT_EQ( q.quasi_factor(), cds::beans::ceil2( c_QuasiFactor ) ); + ASSERT_EQ( q.quasi_factor(), cds::beans::ceil2( c_QuasiFactor )); test( q ); } @@ -106,7 +106,7 @@ namespace { typedef cds::container::SegmentedQueue< gc_type, int, traits > test_queue; test_queue q( c_QuasiFactor ); - ASSERT_EQ( q.quasi_factor(), cds::beans::ceil2( c_QuasiFactor ) ); + ASSERT_EQ( q.quasi_factor(), cds::beans::ceil2( c_QuasiFactor )); test( q ); } @@ -115,7 +115,7 @@ namespace { typedef cds::container::SegmentedQueue< gc_type, std::string > test_queue; test_queue q( c_QuasiFactor ); - ASSERT_EQ( q.quasi_factor(), cds::beans::ceil2( c_QuasiFactor ) ); + ASSERT_EQ( q.quasi_factor(), cds::beans::ceil2( c_QuasiFactor )); test_string( q ); } @@ -128,7 +128,7 @@ namespace { typedef cds::container::SegmentedQueue< gc_type, std::string, traits > test_queue; test_queue q( c_QuasiFactor ); - ASSERT_EQ( q.quasi_factor(), cds::beans::ceil2( c_QuasiFactor ) ); + ASSERT_EQ( q.quasi_factor(), cds::beans::ceil2( c_QuasiFactor )); test_string( q ); } diff --git a/test/unit/queue/segmented_queue_hp.cpp b/test/unit/queue/segmented_queue_hp.cpp index f7fc972a..21b5e87a 100644 --- a/test/unit/queue/segmented_queue_hp.cpp +++ b/test/unit/queue/segmented_queue_hp.cpp @@ -76,7 +76,7 @@ namespace { typedef cds::container::SegmentedQueue< cds::gc::HP, int, traits > test_queue; test_queue q( c_QuasiFactor ); - ASSERT_EQ( q.quasi_factor(), cds::beans::ceil2( c_QuasiFactor ) ); + ASSERT_EQ( q.quasi_factor(), cds::beans::ceil2( c_QuasiFactor )); test( q ); } @@ -90,7 +90,7 @@ namespace { typedef cds::container::SegmentedQueue< cds::gc::HP, int, traits > test_queue; test_queue q( c_QuasiFactor ); - ASSERT_EQ( q.quasi_factor(), cds::beans::ceil2( c_QuasiFactor ) ); + ASSERT_EQ( q.quasi_factor(), cds::beans::ceil2( c_QuasiFactor )); test( q ); } @@ -106,7 +106,7 @@ namespace { typedef cds::container::SegmentedQueue< cds::gc::HP, int, traits > test_queue; test_queue q( c_QuasiFactor ); - ASSERT_EQ( q.quasi_factor(), cds::beans::ceil2( c_QuasiFactor ) ); + ASSERT_EQ( q.quasi_factor(), cds::beans::ceil2( c_QuasiFactor )); test( q ); } @@ -115,7 +115,7 @@ namespace { typedef cds::container::SegmentedQueue< gc_type, std::string > test_queue; test_queue q( c_QuasiFactor ); - ASSERT_EQ( q.quasi_factor(), cds::beans::ceil2( c_QuasiFactor ) ); + ASSERT_EQ( q.quasi_factor(), cds::beans::ceil2( c_QuasiFactor )); test_string( q ); } @@ -128,7 +128,7 @@ namespace { typedef cds::container::SegmentedQueue< gc_type, std::string, traits > test_queue; test_queue q( c_QuasiFactor ); - ASSERT_EQ( q.quasi_factor(), cds::beans::ceil2( c_QuasiFactor ) ); + ASSERT_EQ( q.quasi_factor(), cds::beans::ceil2( c_QuasiFactor )); test_string( q ); } diff --git a/test/unit/queue/test_bounded_queue.h b/test/unit/queue/test_bounded_queue.h index 263ed5f8..18cb423e 100644 --- a/test/unit/queue/test_bounded_queue.h +++ b/test/unit/queue/test_bounded_queue.h @@ -46,7 +46,7 @@ namespace cds_test { const size_t nSize = q.capacity(); - ASSERT_TRUE( q.empty() ); + ASSERT_TRUE( q.empty()); ASSERT_CONTAINER_SIZE( q, 0 ); // enqueue/dequeue @@ -55,16 +55,16 @@ namespace cds_test { ASSERT_TRUE( q.enqueue( it )); ASSERT_CONTAINER_SIZE( q, i + 1 ); } - ASSERT_FALSE( q.empty() ); + ASSERT_FALSE( q.empty()); ASSERT_CONTAINER_SIZE( q, nSize ); for ( size_t i = 0; i < nSize; ++i ) { it = -1; - ASSERT_TRUE( q.dequeue( it ) ); + ASSERT_TRUE( q.dequeue( it )); ASSERT_EQ( it, static_cast( i )); ASSERT_CONTAINER_SIZE( q, nSize - i - 1 ); } - ASSERT_TRUE( q.empty() ); + ASSERT_TRUE( q.empty()); ASSERT_CONTAINER_SIZE( q, 0 ); // push/pop @@ -73,16 +73,16 @@ namespace cds_test { ASSERT_TRUE( q.push( it )); ASSERT_CONTAINER_SIZE( q, i + 1 ); } - ASSERT_FALSE( q.empty() ); + ASSERT_FALSE( q.empty()); ASSERT_CONTAINER_SIZE( q, nSize ); for ( size_t i = 0; i < nSize; ++i ) { it = -1; - ASSERT_TRUE( q.pop( it ) ); + ASSERT_TRUE( q.pop( it )); ASSERT_EQ( it, static_cast( i )); ASSERT_CONTAINER_SIZE( q, nSize - i - 1 ); } - ASSERT_TRUE( q.empty() ); + ASSERT_TRUE( q.empty()); ASSERT_CONTAINER_SIZE( q, 0 ); // push/pop with lambda @@ -97,7 +97,7 @@ namespace cds_test { ASSERT_EQ( it, -1 ); ASSERT_CONTAINER_SIZE( q, i + 1 ); } - ASSERT_FALSE( q.empty() ); + ASSERT_FALSE( q.empty()); ASSERT_CONTAINER_SIZE( q, nSize ); for ( size_t i = 0; i < nSize; ++i ) { @@ -110,39 +110,39 @@ namespace cds_test { ASSERT_EQ( it, static_cast( i )); ASSERT_CONTAINER_SIZE( q, nSize - i - 1 ); } - ASSERT_TRUE( q.empty() ); + ASSERT_TRUE( q.empty()); ASSERT_CONTAINER_SIZE( q, 0u ); for ( size_t i = 0; i < nSize; ++i ) { - ASSERT_TRUE( q.push( static_cast(i) ) ); + ASSERT_TRUE( q.push( static_cast(i)) ); } - ASSERT_FALSE( q.empty() ); + ASSERT_FALSE( q.empty()); ASSERT_CONTAINER_SIZE( q, nSize ); // push in full queue ASSERT_FALSE( q.push( static_cast(nSize * 2 ))); - ASSERT_FALSE( q.empty() ); + ASSERT_FALSE( q.empty()); ASSERT_CONTAINER_SIZE( q, nSize ); it = static_cast( nSize * 2 ); ASSERT_FALSE( q.enqueue( it )); - ASSERT_FALSE( q.empty() ); + ASSERT_FALSE( q.empty()); ASSERT_CONTAINER_SIZE( q, nSize ); // clear q.clear(); - ASSERT_TRUE( q.empty() ); + ASSERT_TRUE( q.empty()); ASSERT_CONTAINER_SIZE( q, 0u ); // pop from empty queue it = static_cast(nSize * 2); - ASSERT_FALSE( q.pop( it ) ); + ASSERT_FALSE( q.pop( it )); ASSERT_EQ( it, static_cast( nSize * 2 )); - ASSERT_TRUE( q.empty() ); + ASSERT_TRUE( q.empty()); ASSERT_CONTAINER_SIZE( q, 0u ); - ASSERT_FALSE( q.dequeue( it ) ); + ASSERT_FALSE( q.dequeue( it )); ASSERT_EQ( it, static_cast( nSize * 2 )); - ASSERT_TRUE( q.empty() ); + ASSERT_TRUE( q.empty()); ASSERT_CONTAINER_SIZE( q, 0u ); } @@ -160,13 +160,13 @@ namespace cds_test { ASSERT_TRUE( q.emplace( str[i].c_str())); ASSERT_CONTAINER_SIZE( q, i + 1 ); } - ASSERT_FALSE( q.empty() ); + ASSERT_FALSE( q.empty()); ASSERT_CONTAINER_SIZE( q, nSize ); { std::string s; auto f = [&s]( std::string& src ) { - ASSERT_FALSE( src.empty() ); + ASSERT_FALSE( src.empty()); s = std::move( src ); ASSERT_NE( s, src ); }; @@ -180,7 +180,7 @@ namespace cds_test { ASSERT_EQ( s, str[i] ); } } - ASSERT_TRUE( q.empty() ); + ASSERT_TRUE( q.empty()); ASSERT_CONTAINER_SIZE( q, 0 ); @@ -192,19 +192,19 @@ namespace cds_test { ASSERT_TRUE( q.enqueue( std::move( s ))); else ASSERT_TRUE( q.push( std::move( s ))); - ASSERT_TRUE( s.empty() ); + ASSERT_TRUE( s.empty()); ASSERT_CONTAINER_SIZE( q, i + 1 ); } - ASSERT_FALSE( q.empty() ); + ASSERT_FALSE( q.empty()); ASSERT_CONTAINER_SIZE( q, nSize ); for ( size_t i = 0; i < nSize; ++i ) { std::string s; - ASSERT_TRUE( q.pop( s ) ); + ASSERT_TRUE( q.pop( s )); ASSERT_CONTAINER_SIZE( q, nSize - i - 1 ); ASSERT_EQ( s, str[i] ); } - ASSERT_TRUE( q.empty() ); + ASSERT_TRUE( q.empty()); ASSERT_CONTAINER_SIZE( q, 0 ); } diff --git a/test/unit/queue/test_generic_queue.h b/test/unit/queue/test_generic_queue.h index 295040ac..67ed8075 100644 --- a/test/unit/queue/test_generic_queue.h +++ b/test/unit/queue/test_generic_queue.h @@ -46,7 +46,7 @@ namespace cds_test { const size_t nSize = 100; - ASSERT_TRUE( q.empty() ); + ASSERT_TRUE( q.empty()); ASSERT_CONTAINER_SIZE( q, 0 ); // enqueue/dequeue @@ -55,16 +55,16 @@ namespace cds_test { ASSERT_TRUE( q.enqueue( it )); ASSERT_CONTAINER_SIZE( q, i + 1 ); } - ASSERT_FALSE( q.empty() ); + ASSERT_FALSE( q.empty()); ASSERT_CONTAINER_SIZE( q, nSize ); for ( size_t i = 0; i < nSize; ++i ) { it = -1; - ASSERT_TRUE( q.dequeue( it ) ); + ASSERT_TRUE( q.dequeue( it )); ASSERT_EQ( it, static_cast( i )); ASSERT_CONTAINER_SIZE( q, nSize - i - 1 ); } - ASSERT_TRUE( q.empty() ); + ASSERT_TRUE( q.empty()); ASSERT_CONTAINER_SIZE( q, 0 ); // push/pop @@ -73,16 +73,16 @@ namespace cds_test { ASSERT_TRUE( q.push( it )); ASSERT_CONTAINER_SIZE( q, i + 1 ); } - ASSERT_FALSE( q.empty() ); + ASSERT_FALSE( q.empty()); ASSERT_CONTAINER_SIZE( q, nSize ); for ( size_t i = 0; i < nSize; ++i ) { it = -1; - ASSERT_TRUE( q.pop( it ) ); + ASSERT_TRUE( q.pop( it )); ASSERT_EQ( it, static_cast( i )); ASSERT_CONTAINER_SIZE( q, nSize - i - 1 ); } - ASSERT_TRUE( q.empty() ); + ASSERT_TRUE( q.empty()); ASSERT_CONTAINER_SIZE( q, 0 ); // push/pop with lambda @@ -97,7 +97,7 @@ namespace cds_test { ASSERT_EQ( it, -1 ); ASSERT_CONTAINER_SIZE( q, i + 1 ); } - ASSERT_FALSE( q.empty() ); + ASSERT_FALSE( q.empty()); ASSERT_CONTAINER_SIZE( q, nSize ); for ( size_t i = 0; i < nSize; ++i ) { @@ -110,30 +110,30 @@ namespace cds_test { ASSERT_EQ( it, static_cast( i )); ASSERT_CONTAINER_SIZE( q, nSize - i - 1 ); } - ASSERT_TRUE( q.empty() ); + ASSERT_TRUE( q.empty()); ASSERT_CONTAINER_SIZE( q, 0 ); // clear for ( size_t i = 0; i < nSize; ++i ) { - ASSERT_TRUE( q.push( static_cast(i) ) ); + ASSERT_TRUE( q.push( static_cast(i)) ); } - ASSERT_FALSE( q.empty() ); + ASSERT_FALSE( q.empty()); ASSERT_CONTAINER_SIZE( q, nSize ); q.clear(); - ASSERT_TRUE( q.empty() ); + ASSERT_TRUE( q.empty()); ASSERT_CONTAINER_SIZE( q, 0 ); // pop from empty queue it = nSize * 2; - ASSERT_FALSE( q.pop( it ) ); + ASSERT_FALSE( q.pop( it )); ASSERT_EQ( it, static_cast( nSize * 2 )); - ASSERT_TRUE( q.empty() ); + ASSERT_TRUE( q.empty()); ASSERT_CONTAINER_SIZE( q, 0 ); - ASSERT_FALSE( q.dequeue( it ) ); + ASSERT_FALSE( q.dequeue( it )); ASSERT_EQ( it, static_cast( nSize * 2 )); - ASSERT_TRUE( q.empty() ); + ASSERT_TRUE( q.empty()); ASSERT_CONTAINER_SIZE( q, 0 ); } @@ -151,13 +151,13 @@ namespace cds_test { ASSERT_TRUE( q.emplace( str[i].c_str())); ASSERT_CONTAINER_SIZE( q, i + 1 ); } - ASSERT_FALSE( q.empty() ); + ASSERT_FALSE( q.empty()); ASSERT_CONTAINER_SIZE( q, nSize ); { std::string s; auto f = [&s]( std::string& src ) { - ASSERT_FALSE( src.empty() ); + ASSERT_FALSE( src.empty()); s = std::move( src ); ASSERT_NE( s, src ); }; @@ -171,31 +171,31 @@ namespace cds_test { ASSERT_EQ( s, str[i] ); } } - ASSERT_TRUE( q.empty() ); + ASSERT_TRUE( q.empty()); ASSERT_CONTAINER_SIZE( q, 0 ); // move push for ( size_t i = 0; i < nSize; ++i ) { std::string s = str[i]; - ASSERT_FALSE( s.empty() ); + ASSERT_FALSE( s.empty()); if ( i & 1 ) ASSERT_TRUE( q.enqueue( std::move( s ))); else ASSERT_TRUE( q.push( std::move( s ))); - ASSERT_TRUE( s.empty() ); + ASSERT_TRUE( s.empty()); ASSERT_CONTAINER_SIZE( q, i + 1 ); } - ASSERT_FALSE( q.empty() ); + ASSERT_FALSE( q.empty()); ASSERT_CONTAINER_SIZE( q, nSize ); for ( size_t i = 0; i < nSize; ++i ) { std::string s; - ASSERT_TRUE( q.pop( s ) ); + ASSERT_TRUE( q.pop( s )); ASSERT_CONTAINER_SIZE( q, nSize - i - 1 ); ASSERT_EQ( s, str[i] ); } - ASSERT_TRUE( q.empty() ); + ASSERT_TRUE( q.empty()); ASSERT_CONTAINER_SIZE( q, 0 ); } diff --git a/test/unit/queue/test_intrusive_bounded_queue.h b/test/unit/queue/test_intrusive_bounded_queue.h index 69a6452f..a5bb7073 100644 --- a/test/unit/queue/test_intrusive_bounded_queue.h +++ b/test/unit/queue/test_intrusive_bounded_queue.h @@ -57,7 +57,7 @@ namespace cds_test { const size_t nSize = q.capacity(); - ASSERT_TRUE( q.empty() ); + ASSERT_TRUE( q.empty()); ASSERT_CONTAINER_SIZE( q, 0 ); std::vector< value_type > arr; @@ -74,14 +74,14 @@ namespace cds_test { ASSERT_TRUE( q.enqueue( i )); } ASSERT_CONTAINER_SIZE( q, i.nVal + 1 ); - ASSERT_FALSE( q.empty() ); + ASSERT_FALSE( q.empty()); } - ASSERT_CONTAINER_SIZE( q, q.capacity() ); + ASSERT_CONTAINER_SIZE( q, q.capacity()); // pop int val = 0; - while ( !q.empty() ) { + while ( !q.empty()) { value_type * v; if ( val & 1 ) v = q.pop(); @@ -95,25 +95,25 @@ namespace cds_test { } ASSERT_EQ( val, static_cast( nSize )); - ASSERT_TRUE( q.empty() ); + ASSERT_TRUE( q.empty()); ASSERT_CONTAINER_SIZE( q, 0 ); // pop from empty queue { value_type * v = q.pop(); ASSERT_TRUE( v == nullptr ); - ASSERT_TRUE( q.empty() ); + ASSERT_TRUE( q.empty()); ASSERT_CONTAINER_SIZE( q, 0 ); } // clear for ( auto& i : arr ) { - ASSERT_TRUE( q.push( i ) ); + ASSERT_TRUE( q.push( i )); } - ASSERT_FALSE( q.empty() ); - ASSERT_CONTAINER_SIZE( q, q.capacity() ); + ASSERT_FALSE( q.empty()); + ASSERT_CONTAINER_SIZE( q, q.capacity()); q.clear(); - ASSERT_TRUE( q.empty() ); + ASSERT_TRUE( q.empty()); ASSERT_CONTAINER_SIZE( q, 0 ); if ( std::is_same::value ) { @@ -131,13 +131,13 @@ namespace cds_test { // clear with disposer for ( auto& i : arr ) { - ASSERT_TRUE( q.push( i ) ); + ASSERT_TRUE( q.push( i )); i.nDisposeCount = 0; } - ASSERT_FALSE( q.empty() ); - ASSERT_CONTAINER_SIZE( q, q.capacity() ); + ASSERT_FALSE( q.empty()); + ASSERT_CONTAINER_SIZE( q, q.capacity()); q.clear( []( value_type * p ) { p->nDisposeCount = p->nVal + 1; } ); - ASSERT_TRUE( q.empty() ); + ASSERT_TRUE( q.empty()); ASSERT_CONTAINER_SIZE( q, 0 ); // check the disposer has not been called for ( auto& i : arr ) { diff --git a/test/unit/queue/test_intrusive_msqueue.h b/test/unit/queue/test_intrusive_msqueue.h index 3190f866..f4e955db 100644 --- a/test/unit/queue/test_intrusive_msqueue.h +++ b/test/unit/queue/test_intrusive_msqueue.h @@ -90,18 +90,18 @@ namespace cds_test { for ( size_t i = 0; i < nSize; ++i ) arr[i].nVal = static_cast(i); - ASSERT_TRUE( q.empty() ); + ASSERT_TRUE( q.empty()); ASSERT_CONTAINER_SIZE( q, 0 ); // pop from empty queue pv = q.pop(); ASSERT_TRUE( pv == nullptr ); - ASSERT_TRUE( q.empty() ); + ASSERT_TRUE( q.empty()); ASSERT_CONTAINER_SIZE( q, 0 ); pv =q.dequeue(); ASSERT_TRUE( pv == nullptr ); - ASSERT_TRUE( q.empty() ); + ASSERT_TRUE( q.empty()); ASSERT_CONTAINER_SIZE( q, 0 ); // push/pop test @@ -115,7 +115,7 @@ namespace cds_test { } for ( size_t i = 0; i < nSize; ++i ) { - ASSERT_FALSE( q.empty() ); + ASSERT_FALSE( q.empty()); ASSERT_CONTAINER_SIZE( q, nSize - i ); if ( i & 1 ) pv = q.pop(); @@ -124,7 +124,7 @@ namespace cds_test { ASSERT_FALSE( pv == nullptr ); ASSERT_EQ( pv->nVal, static_cast(i)); } - ASSERT_TRUE( q.empty() ); + ASSERT_TRUE( q.empty()); ASSERT_CONTAINER_SIZE( q, 0 ); Queue::gc::scan(); @@ -138,11 +138,11 @@ namespace cds_test { for ( size_t i = 0; i < nSize; ++i ) q.push( arr[i] ); - ASSERT_FALSE( q.empty() ); + ASSERT_FALSE( q.empty()); ASSERT_CONTAINER_SIZE( q, nSize ); q.clear(); - ASSERT_TRUE( q.empty() ); + ASSERT_TRUE( q.empty()); ASSERT_CONTAINER_SIZE( q, 0 ); Queue::gc::scan(); diff --git a/test/unit/queue/test_intrusive_segmented_queue.h b/test/unit/queue/test_intrusive_segmented_queue.h index 5c151806..90ece348 100644 --- a/test/unit/queue/test_intrusive_segmented_queue.h +++ b/test/unit/queue/test_intrusive_segmented_queue.h @@ -99,19 +99,19 @@ namespace cds_test { // push/enqueue for ( size_t i = 0; i < val.size(); ++i ) { if ( i & 1 ) { - ASSERT_TRUE( q.push( val[i] ) ); + ASSERT_TRUE( q.push( val[i] )); } else { - ASSERT_TRUE( q.enqueue( val[i] ) ); + ASSERT_TRUE( q.enqueue( val[i] )); } ASSERT_CONTAINER_SIZE( q, i + 1 ); } - EXPECT_TRUE( !q.empty() ); + EXPECT_TRUE( !q.empty()); // pop/dequeue size_t nCount = 0; - while ( !q.empty() ) { + while ( !q.empty()) { value_type * pVal; if ( nCount & 1 ) pVal = q.pop(); @@ -120,21 +120,21 @@ namespace cds_test { ASSERT_TRUE( pVal != nullptr ); - int nSegment = int( nCount / q.quasi_factor() ); - int nMin = nSegment * int( q.quasi_factor() ); - int nMax = nMin + int( q.quasi_factor() ) - 1; + int nSegment = int( nCount / q.quasi_factor()); + int nMin = nSegment * int( q.quasi_factor()); + int nMax = nMin + int( q.quasi_factor()) - 1; EXPECT_TRUE( nMin <= pVal->nValue && pVal->nValue <= nMax ) << nMin << " <= " << pVal->nValue << " <= " << nMax; ++nCount; EXPECT_CONTAINER_SIZE( q, val.size() - nCount ); } EXPECT_EQ( nCount, val.size()); - EXPECT_TRUE( q.empty() ); + EXPECT_TRUE( q.empty()); EXPECT_CONTAINER_SIZE( q, 0u ); // pop from empty queue ASSERT_TRUE( q.pop() == nullptr ); - EXPECT_TRUE( q.empty() ); + EXPECT_TRUE( q.empty()); EXPECT_CONTAINER_SIZE( q, 0u ); // check that Disposer has not been called @@ -146,13 +146,13 @@ namespace cds_test { // clear for ( size_t i = 0; i < val.size(); ++i ) - EXPECT_TRUE( q.push( val[i] ) ); + EXPECT_TRUE( q.push( val[i] )); EXPECT_CONTAINER_SIZE( q, val.size()); - EXPECT_TRUE( !q.empty() ); + EXPECT_TRUE( !q.empty()); q.clear(); EXPECT_CONTAINER_SIZE( q, 0u ); - EXPECT_TRUE( q.empty() ); + EXPECT_TRUE( q.empty()); // check if Disposer has been called Queue::gc::force_dispose(); @@ -163,13 +163,13 @@ namespace cds_test { // clear_with for ( size_t i = 0; i < val.size(); ++i ) - EXPECT_TRUE( q.push( val[i] ) ); - EXPECT_CONTAINER_SIZE( q, val.size() ); - EXPECT_TRUE( !q.empty() ); + EXPECT_TRUE( q.push( val[i] )); + EXPECT_CONTAINER_SIZE( q, val.size()); + EXPECT_TRUE( !q.empty()); - q.clear_with( Disposer2() ); + q.clear_with( Disposer2()); EXPECT_CONTAINER_SIZE( q, 0u ); - EXPECT_TRUE( q.empty() ); + EXPECT_TRUE( q.empty()); // check if Disposer has been called Queue::gc::force_dispose(); diff --git a/test/unit/queue/test_segmented_queue.h b/test/unit/queue/test_segmented_queue.h index 756b9f20..db0e66da 100644 --- a/test/unit/queue/test_segmented_queue.h +++ b/test/unit/queue/test_segmented_queue.h @@ -46,7 +46,7 @@ namespace cds_test { const size_t nSize = 100; - ASSERT_TRUE( q.empty() ); + ASSERT_TRUE( q.empty()); ASSERT_CONTAINER_SIZE( q, 0 ); // enqueue/dequeue @@ -55,21 +55,21 @@ namespace cds_test { ASSERT_TRUE( q.enqueue( it )); ASSERT_CONTAINER_SIZE( q, i + 1 ); } - ASSERT_FALSE( q.empty() ); + ASSERT_FALSE( q.empty()); ASSERT_CONTAINER_SIZE( q, nSize ); for ( size_t i = 0; i < nSize; ++i ) { it = -1; - ASSERT_TRUE( q.dequeue( it ) ); + ASSERT_TRUE( q.dequeue( it )); ASSERT_CONTAINER_SIZE( q, nSize - i - 1 ); - int nSegment = int( i / q.quasi_factor() ); - int nMin = nSegment * int( q.quasi_factor() ); - int nMax = nMin + int( q.quasi_factor() ) - 1; + int nSegment = int( i / q.quasi_factor()); + int nMin = nSegment * int( q.quasi_factor()); + int nMax = nMin + int( q.quasi_factor()) - 1; EXPECT_LE( nMin, it ); EXPECT_LE( it, nMax ); } - ASSERT_TRUE( q.empty() ); + ASSERT_TRUE( q.empty()); ASSERT_CONTAINER_SIZE( q, 0 ); // push/pop @@ -78,7 +78,7 @@ namespace cds_test { ASSERT_TRUE( q.push( it )); ASSERT_CONTAINER_SIZE( q, i + 1 ); } - ASSERT_FALSE( q.empty() ); + ASSERT_FALSE( q.empty()); ASSERT_CONTAINER_SIZE( q, nSize ); size_t nPushed = nSize; @@ -86,7 +86,7 @@ namespace cds_test { size_t nOffset = nPushed % q.quasi_factor(); for ( size_t i = 0; i < nSize; ++i ) { it = -1; - ASSERT_TRUE( q.pop( it ) ); + ASSERT_TRUE( q.pop( it )); ASSERT_CONTAINER_SIZE( q, nSize - i - 1 ); int nSegment = static_cast((i + nPushed) / q.quasi_factor() - nStartSegment ); @@ -97,7 +97,7 @@ namespace cds_test { EXPECT_LE( nMin, it ); EXPECT_LE( it, nMax ); } - ASSERT_TRUE( q.empty() ); + ASSERT_TRUE( q.empty()); ASSERT_CONTAINER_SIZE( q, 0 ); // push/pop with lambda @@ -112,7 +112,7 @@ namespace cds_test { ASSERT_EQ( it, -1 ); ASSERT_CONTAINER_SIZE( q, i + 1 ); } - ASSERT_FALSE( q.empty() ); + ASSERT_FALSE( q.empty()); ASSERT_CONTAINER_SIZE( q, nSize ); nPushed += nSize; @@ -135,30 +135,30 @@ namespace cds_test { EXPECT_LE( nMin, it ); EXPECT_LE( it, nMax ); } - ASSERT_TRUE( q.empty() ); + ASSERT_TRUE( q.empty()); ASSERT_CONTAINER_SIZE( q, 0 ); // clear for ( size_t i = 0; i < nSize; ++i ) { - ASSERT_TRUE( q.push( static_cast(i) ) ); + ASSERT_TRUE( q.push( static_cast(i)) ); } - ASSERT_FALSE( q.empty() ); + ASSERT_FALSE( q.empty()); ASSERT_CONTAINER_SIZE( q, nSize ); q.clear(); - ASSERT_TRUE( q.empty() ); + ASSERT_TRUE( q.empty()); ASSERT_CONTAINER_SIZE( q, 0 ); // pop from empty queue it = nSize * 2; - ASSERT_FALSE( q.pop( it ) ); + ASSERT_FALSE( q.pop( it )); ASSERT_EQ( it, static_cast( nSize * 2 )); - ASSERT_TRUE( q.empty() ); + ASSERT_TRUE( q.empty()); ASSERT_CONTAINER_SIZE( q, 0 ); - ASSERT_FALSE( q.dequeue( it ) ); + ASSERT_FALSE( q.dequeue( it )); ASSERT_EQ( it, static_cast( nSize * 2 )); - ASSERT_TRUE( q.empty() ); + ASSERT_TRUE( q.empty()); ASSERT_CONTAINER_SIZE( q, 0 ); } @@ -176,13 +176,13 @@ namespace cds_test { ASSERT_TRUE( q.emplace( str[i].c_str())); ASSERT_CONTAINER_SIZE( q, i + 1 ); } - ASSERT_FALSE( q.empty() ); + ASSERT_FALSE( q.empty()); ASSERT_CONTAINER_SIZE( q, nSize ); { std::string s; auto f = [&s]( std::string& src ) { - ASSERT_FALSE( src.empty() ); + ASSERT_FALSE( src.empty()); s = std::move( src ); ASSERT_NE( s, src ); }; @@ -196,31 +196,31 @@ namespace cds_test { ASSERT_TRUE( s == str[0] || s == str[1] || s == str[2] ); } } - ASSERT_TRUE( q.empty() ); + ASSERT_TRUE( q.empty()); ASSERT_CONTAINER_SIZE( q, 0 ); // move push for ( size_t i = 0; i < nSize; ++i ) { std::string s = str[i]; - ASSERT_FALSE( s.empty() ); + ASSERT_FALSE( s.empty()); if ( i & 1 ) ASSERT_TRUE( q.enqueue( std::move( s ))); else ASSERT_TRUE( q.push( std::move( s ))); - ASSERT_TRUE( s.empty() ); + ASSERT_TRUE( s.empty()); ASSERT_CONTAINER_SIZE( q, i + 1 ); } - ASSERT_FALSE( q.empty() ); + ASSERT_FALSE( q.empty()); ASSERT_CONTAINER_SIZE( q, nSize ); for ( size_t i = 0; i < nSize; ++i ) { std::string s; - ASSERT_TRUE( q.pop( s ) ); + ASSERT_TRUE( q.pop( s )); ASSERT_CONTAINER_SIZE( q, nSize - i - 1 ); ASSERT_TRUE( s == str[0] || s == str[1] || s == str[2] ); } - ASSERT_TRUE( q.empty() ); + ASSERT_TRUE( q.empty()); ASSERT_CONTAINER_SIZE( q, 0 ); } diff --git a/test/unit/set/test_feldman_hashset.h b/test/unit/set/test_feldman_hashset.h index b58f6db2..b6cb41b7 100644 --- a/test/unit/set/test_feldman_hashset.h +++ b/test/unit/set/test_feldman_hashset.h @@ -61,7 +61,7 @@ namespace cds_test { void clear_stat() { - memset( this, 0, sizeof( *this ) ); + memset( this, 0, sizeof( *this )); } }; @@ -96,7 +96,7 @@ namespace cds_test { template explicit int_item( Q const& src ) - : nKey( src.key() ) + : nKey( src.key()) , nVal( 0 ) {} @@ -109,17 +109,17 @@ namespace cds_test { int_item( int_item&& src ) : nKey( src.nKey ) , nVal( src.nVal ) - , strVal( std::move( src.strVal ) ) + , strVal( std::move( src.strVal )) {} int_item( int k, std::string&& s ) : nKey( k ) , nVal( k * 2 ) - , strVal( std::move( s ) ) + , strVal( std::move( s )) {} explicit int_item( other_item const& s ) - : nKey( s.key() ) + : nKey( s.key()) , nVal( s.key() * 2 ) {} @@ -199,7 +199,7 @@ namespace cds_test { // Precondition: set is empty // Postcondition: set is empty - ASSERT_TRUE( s.empty() ); + ASSERT_TRUE( s.empty()); ASSERT_CONTAINER_SIZE( s, 0 ); size_t const nSetSize = kSize; @@ -210,16 +210,16 @@ namespace cds_test { data.reserve( kSize ); indices.reserve( kSize ); for ( size_t key = 0; key < kSize; ++key ) { - data.push_back( value_type( static_cast(key) ) ); + data.push_back( value_type( static_cast(key)) ); indices.push_back( key ); } - shuffle( indices.begin(), indices.end() ); + shuffle( indices.begin(), indices.end()); // insert/find for ( auto idx : indices ) { auto& i = data[idx]; - ASSERT_FALSE( s.contains( i.nKey ) ); + ASSERT_FALSE( s.contains( i.nKey )); ASSERT_FALSE( s.find( i.nKey, []( value_type& ) {} )); std::pair updResult; @@ -239,18 +239,18 @@ namespace cds_test { updResult = s.update( i, []( value_type& val, value_type * prev ) { ASSERT_TRUE( prev != nullptr ); - EXPECT_EQ( val.key(), prev->key() ); + EXPECT_EQ( val.key(), prev->key()); }, false ); EXPECT_TRUE( updResult.first ); EXPECT_FALSE( updResult.second ); break; case 1: - ASSERT_TRUE( s.insert( i.key() )); - ASSERT_FALSE( s.insert( i.key() )); + ASSERT_TRUE( s.insert( i.key())); + ASSERT_FALSE( s.insert( i.key())); updResult = s.update( i.key(), []( value_type& val, value_type * prev ) { ASSERT_TRUE( prev != nullptr ); - EXPECT_EQ( val.key(), prev->key() ); + EXPECT_EQ( val.key(), prev->key()); }, false ); EXPECT_TRUE( updResult.first ); EXPECT_FALSE( updResult.second ); @@ -284,7 +284,7 @@ namespace cds_test { { ASSERT_TRUE( prev != nullptr ); EXPECT_EQ( prev->nUpdateNewCount, 1u ); - EXPECT_EQ( v.key(), prev->key() ); + EXPECT_EQ( v.key(), prev->key()); ++v.nUpdateCount; }, false ); EXPECT_TRUE( updResult.first ); @@ -308,7 +308,7 @@ namespace cds_test { updResult = s.update( i.key(), []( value_type& v, value_type * prev ) { ASSERT_TRUE( prev != nullptr ); - EXPECT_EQ( v.key(), prev->key() ); + EXPECT_EQ( v.key(), prev->key()); EXPECT_EQ( prev->nUpdateNewCount, 1u ); EXPECT_EQ( v.nUpdateNewCount, 0u ); ++v.nUpdateNewCount; @@ -319,77 +319,77 @@ namespace cds_test { ASSERT_TRUE( s.find( i.key(), []( value_type const& v ) { EXPECT_EQ( v.nUpdateNewCount, 1u ); - } ) ); + } )); break; case 6: - ASSERT_TRUE( s.emplace( i.key() ) ); - ASSERT_TRUE( s.contains( i.key() ) ); + ASSERT_TRUE( s.emplace( i.key()) ); + ASSERT_TRUE( s.contains( i.key()) ); break; case 7: str = "Hello!"; - ASSERT_TRUE( s.emplace( i.key(), std::move( str ) ) ); - EXPECT_TRUE( str.empty() ); + ASSERT_TRUE( s.emplace( i.key(), std::move( str )) ); + EXPECT_TRUE( str.empty()); ASSERT_TRUE( s.find( i.key(), []( value_type const& v ) { - EXPECT_EQ( v.strVal, std::string( "Hello!" ) ); - } ) ); + EXPECT_EQ( v.strVal, std::string( "Hello!" )); + } )); break; default: // forgot anything?.. ASSERT_TRUE( false ); } - ASSERT_TRUE( s.contains( i.nKey ) ); - ASSERT_TRUE( s.find( i.nKey, []( value_type& ) {} ) ); + ASSERT_TRUE( s.contains( i.nKey )); + ASSERT_TRUE( s.find( i.nKey, []( value_type& ) {} )); } - ASSERT_FALSE( s.empty() ); + ASSERT_FALSE( s.empty()); ASSERT_CONTAINER_SIZE( s, nSetSize ); // erase - shuffle( indices.begin(), indices.end() ); + shuffle( indices.begin(), indices.end()); for ( auto idx : indices ) { auto& i = data[idx]; - ASSERT_TRUE( s.contains( i.nKey ) ); + ASSERT_TRUE( s.contains( i.nKey )); ASSERT_TRUE( s.find( i.nKey, []( value_type& v ) { v.nFindCount = 1; - } ) ); + } )); int nKey = i.key() - 1; switch ( idx % 2 ) { case 0: - ASSERT_TRUE( s.erase( i.key() ) ); - ASSERT_FALSE( s.erase( i.key() ) ); + ASSERT_TRUE( s.erase( i.key()) ); + ASSERT_FALSE( s.erase( i.key()) ); break; case 1: ASSERT_TRUE( s.erase( i.key(), [&nKey]( value_type const& v ) { EXPECT_EQ( v.nFindCount, 1u ); nKey = v.key(); - } ) ); + } )); EXPECT_EQ( i.key(), nKey ); nKey = i.key() - 1; ASSERT_FALSE( s.erase( i.key(), [&nKey]( value_type const& v ) { nKey = v.key(); - } ) ); + } )); EXPECT_EQ( i.key(), nKey + 1 ); break; } - ASSERT_FALSE( s.contains( i.nKey ) ); - ASSERT_FALSE( s.find( i.nKey, []( value_type const& ) {} ) ); + ASSERT_FALSE( s.contains( i.nKey )); + ASSERT_FALSE( s.find( i.nKey, []( value_type const& ) {} )); } - ASSERT_TRUE( s.empty() ); + ASSERT_TRUE( s.empty()); ASSERT_CONTAINER_SIZE( s, 0u ); // clear for ( auto& i : data ) { - ASSERT_TRUE( s.insert( i ) ); + ASSERT_TRUE( s.insert( i )); } { @@ -398,24 +398,24 @@ namespace cds_test { std::vector< typename Set::level_statistics > lstat; s.get_level_statistics( lstat ); - EXPECT_EQ( lstat[0].node_capacity, s.head_size() ); + EXPECT_EQ( lstat[0].node_capacity, s.head_size()); for ( size_t i = 1; i < lstat.size(); ++i ) { EXPECT_EQ( lstat[i].node_capacity, s.array_node_size()); } } - ASSERT_FALSE( s.empty() ); + ASSERT_FALSE( s.empty()); ASSERT_CONTAINER_SIZE( s, nSetSize ); s.clear(); - ASSERT_TRUE( s.empty() ); + ASSERT_TRUE( s.empty()); ASSERT_CONTAINER_SIZE( s, 0u ); - ASSERT_TRUE( s.begin() == s.end() ); - ASSERT_TRUE( s.cbegin() == s.cend() ); - ASSERT_TRUE( s.rbegin() == s.rend() ); - ASSERT_TRUE( s.crbegin() == s.crend() ); + ASSERT_TRUE( s.begin() == s.end()); + ASSERT_TRUE( s.cbegin() == s.cend()); + ASSERT_TRUE( s.rbegin() == s.rend()); + ASSERT_TRUE( s.crbegin() == s.crend()); } }; diff --git a/test/unit/set/test_feldman_hashset_hp.h b/test/unit/set/test_feldman_hashset_hp.h index 8d4ad882..805e5a79 100644 --- a/test/unit/set/test_feldman_hashset_hp.h +++ b/test/unit/set/test_feldman_hashset_hp.h @@ -46,7 +46,7 @@ namespace cds_test { // Precondition: set is empty // Postcondition: set is empty - ASSERT_TRUE( s.empty() ); + ASSERT_TRUE( s.empty()); ASSERT_CONTAINER_SIZE( s, 0 ); base_class::test( s ); @@ -59,15 +59,15 @@ namespace cds_test { data.reserve( kSize ); indices.reserve( kSize ); for ( size_t key = 0; key < kSize; ++key ) { - data.push_back( value_type( static_cast(key) ) ); + data.push_back( value_type( static_cast(key)) ); indices.push_back( key ); } - shuffle( indices.begin(), indices.end() ); + shuffle( indices.begin(), indices.end()); for ( auto& i : data ) { - ASSERT_TRUE( s.insert( i ) ); + ASSERT_TRUE( s.insert( i )); } - ASSERT_FALSE( s.empty() ); + ASSERT_FALSE( s.empty()); ASSERT_CONTAINER_SIZE( s, nSetSize ); // iterator test @@ -100,7 +100,7 @@ namespace cds_test { gp = s.get( i.key()); ASSERT_FALSE( !gp ); - EXPECT_EQ( gp->key(), i.key() ); + EXPECT_EQ( gp->key(), i.key()); EXPECT_EQ( gp->nFindCount, static_cast( i.key() * 2 )); gp->nFindCount *= 2; @@ -112,33 +112,33 @@ namespace cds_test { auto& i = data[idx]; ASSERT_TRUE( !gp ); - gp = s.extract( i.key() ); + gp = s.extract( i.key()); ASSERT_FALSE( !gp ); - EXPECT_EQ( gp->key(), i.key() ); + EXPECT_EQ( gp->key(), i.key()); EXPECT_EQ( gp->nFindCount, static_cast( i.key() * 4 )); - gp = s.extract( i.key() ); + gp = s.extract( i.key()); ASSERT_TRUE( !gp ); } - ASSERT_TRUE( s.empty() ); + ASSERT_TRUE( s.empty()); ASSERT_CONTAINER_SIZE( s, 0 ); // erase_at() for ( auto& i : data ) { - ASSERT_TRUE( s.insert( i ) ); + ASSERT_TRUE( s.insert( i )); } - ASSERT_FALSE( s.empty() ); + ASSERT_FALSE( s.empty()); ASSERT_CONTAINER_SIZE( s, nSetSize ); for ( auto it = s.begin(); it != s.end(); ++it ) { int key = it->key(); ASSERT_TRUE( s.erase_at( it )); EXPECT_EQ( it->key(), key ); - ASSERT_FALSE( s.erase_at( it ) ); + ASSERT_FALSE( s.erase_at( it )); } - ASSERT_TRUE( s.empty() ); + ASSERT_TRUE( s.empty()); ASSERT_CONTAINER_SIZE( s, 0 ); } diff --git a/test/unit/set/test_feldman_hashset_rcu.h b/test/unit/set/test_feldman_hashset_rcu.h index 1ec36283..bf759299 100644 --- a/test/unit/set/test_feldman_hashset_rcu.h +++ b/test/unit/set/test_feldman_hashset_rcu.h @@ -53,7 +53,7 @@ namespace { // Precondition: set is empty // Postcondition: set is empty - ASSERT_TRUE( s.empty() ); + ASSERT_TRUE( s.empty()); ASSERT_CONTAINER_SIZE( s, 0 ); base_class::test( s ); @@ -66,15 +66,15 @@ namespace { data.reserve( kSize ); indices.reserve( kSize ); for ( size_t key = 0; key < kSize; ++key ) { - data.push_back( value_type( static_cast(key) ) ); + data.push_back( value_type( static_cast(key)) ); indices.push_back( key ); } - shuffle( indices.begin(), indices.end() ); + shuffle( indices.begin(), indices.end()); for ( auto& i : data ) { - ASSERT_TRUE( s.insert( i ) ); + ASSERT_TRUE( s.insert( i )); } - ASSERT_FALSE( s.empty() ); + ASSERT_FALSE( s.empty()); ASSERT_CONTAINER_SIZE( s, nSetSize ); typedef typename Set::rcu_lock rcu_lock; @@ -110,7 +110,7 @@ namespace { rcu_lock l; value_type * p = s.get( i.key()); ASSERT_TRUE( p != nullptr ); - EXPECT_EQ( p->key(), i.key() ); + EXPECT_EQ( p->key(), i.key()); EXPECT_EQ( p->nFindCount, static_cast( i.key() * 2 )); p->nFindCount *= 2; } @@ -122,22 +122,22 @@ namespace { auto& i = data[idx]; ASSERT_TRUE( !xp ); - xp = s.extract( i.key() ); + xp = s.extract( i.key()); ASSERT_FALSE( !xp ); - EXPECT_EQ( xp->key(), i.key() ); + EXPECT_EQ( xp->key(), i.key()); EXPECT_EQ( xp->nFindCount, static_cast( i.key() * 4 )); - xp = s.extract( i.key() ); + xp = s.extract( i.key()); ASSERT_TRUE( !xp ); { rcu_lock l; - value_type * p = s.get( i.key() ); + value_type * p = s.get( i.key()); EXPECT_TRUE( p == nullptr ); } } - ASSERT_TRUE( s.empty() ); + ASSERT_TRUE( s.empty()); ASSERT_CONTAINER_SIZE( s, 0 ); } diff --git a/test/unit/set/test_michael_iterable.h b/test/unit/set/test_michael_iterable.h index 394483db..3a45bc24 100644 --- a/test/unit/set/test_michael_iterable.h +++ b/test/unit/set/test_michael_iterable.h @@ -44,7 +44,7 @@ namespace cds_test { // Precondition: set is empty // Postcondition: set is empty - EXPECT_TRUE( s.empty() ); + EXPECT_TRUE( s.empty()); EXPECT_CONTAINER_SIZE( s, 0 ); size_t const nSetSize = kSize; @@ -55,24 +55,24 @@ namespace cds_test { data.reserve( kSize ); indices.reserve( kSize ); for ( size_t key = 0; key < kSize; ++key ) { - data.push_back( value_type( static_cast(key) ) ); + data.push_back( value_type( static_cast(key)) ); indices.push_back( key ); } - shuffle( indices.begin(), indices.end() ); + shuffle( indices.begin(), indices.end()); // insert/find for ( auto idx : indices ) { auto& i = data[idx]; - EXPECT_FALSE( s.contains( i.nKey ) ); - EXPECT_FALSE( s.contains( i ) ); - EXPECT_FALSE( s.contains( other_item( i.key() ), other_less())); + EXPECT_FALSE( s.contains( i.nKey )); + EXPECT_FALSE( s.contains( i )); + EXPECT_FALSE( s.contains( other_item( i.key()), other_less())); EXPECT_FALSE( s.find( i.nKey, []( value_type&, int ) {} )); EXPECT_FALSE( s.find( i, []( value_type&, value_type const& ) {} )); EXPECT_FALSE( s.find_with( other_item( i.key()), other_less(), []( value_type&, other_item const& ) {} )); EXPECT_TRUE( s.find( i ) == s.end()); - EXPECT_TRUE( s.find( i.nKey ) == s.end() ); - EXPECT_TRUE( s.find_with( other_item( i.key()), other_less()) == s.end() ); + EXPECT_TRUE( s.find( i.nKey ) == s.end()); + EXPECT_TRUE( s.find_with( other_item( i.key()), other_less()) == s.end()); std::pair updResult; @@ -91,18 +91,18 @@ namespace cds_test { updResult = s.update( i, []( value_type& val, value_type* old) { ASSERT_FALSE( old == nullptr ); - EXPECT_EQ( val.key(), old->key() ); + EXPECT_EQ( val.key(), old->key()); }, false ); EXPECT_TRUE( updResult.first ); EXPECT_FALSE( updResult.second ); break; case 1: - EXPECT_TRUE( s.insert( i.key() )); - EXPECT_FALSE( s.insert( i.key() )); + EXPECT_TRUE( s.insert( i.key())); + EXPECT_FALSE( s.insert( i.key())); updResult = s.update( i.key(), []( value_type& val, value_type* old) { ASSERT_FALSE( old == nullptr ); - EXPECT_EQ( val.key(), old->key() ); + EXPECT_EQ( val.key(), old->key()); }, false ); EXPECT_TRUE( updResult.first ); EXPECT_FALSE( updResult.second ); @@ -129,7 +129,7 @@ namespace cds_test { updResult = s.update( i, [&i]( value_type& v, value_type* old ) { EXPECT_TRUE( old == nullptr ); - EXPECT_EQ( v.key(), i.key() ); + EXPECT_EQ( v.key(), i.key()); ++v.nUpdateNewCount; }); EXPECT_TRUE( updResult.first ); @@ -138,7 +138,7 @@ namespace cds_test { updResult = s.update( i, []( value_type& v, value_type* old ) { ASSERT_FALSE( old == nullptr ); - EXPECT_EQ( v.key(), old->key() ); + EXPECT_EQ( v.key(), old->key()); EXPECT_EQ( old->nUpdateNewCount, 1u ); v.nUpdateNewCount = old->nUpdateNewCount; ++v.nUpdateCount; @@ -157,7 +157,7 @@ namespace cds_test { updResult = s.update( i.key(), [&i]( value_type& v, value_type* old ) { EXPECT_TRUE( old == nullptr ); - EXPECT_EQ( v.key(), i.key() ); + EXPECT_EQ( v.key(), i.key()); ++v.nUpdateNewCount; }); EXPECT_TRUE( updResult.first ); @@ -166,7 +166,7 @@ namespace cds_test { updResult = s.update( i.key(), []( value_type& v, value_type* old ) { EXPECT_FALSE( old == nullptr ); - EXPECT_EQ( v.key(), old->key() ); + EXPECT_EQ( v.key(), old->key()); EXPECT_EQ( old->nUpdateNewCount, 1u ); v.nUpdateNewCount = old->nUpdateNewCount; ++v.nUpdateCount; @@ -176,7 +176,7 @@ namespace cds_test { EXPECT_TRUE( s.find( i, []( value_type const& v, value_type const& arg ) { - EXPECT_EQ( v.key(), arg.key() ); + EXPECT_EQ( v.key(), arg.key()); EXPECT_EQ( v.nUpdateNewCount, 1u ); EXPECT_EQ( v.nUpdateCount, 1u ); })); @@ -185,7 +185,7 @@ namespace cds_test { EXPECT_TRUE( s.emplace( i.key())); EXPECT_TRUE( s.find( i, []( value_type const& v, value_type const& arg ) { - EXPECT_EQ( v.key(), arg.key() ); + EXPECT_EQ( v.key(), arg.key()); EXPECT_EQ( v.nVal, arg.nVal ); })); break; @@ -195,21 +195,21 @@ namespace cds_test { EXPECT_TRUE( str.empty()); EXPECT_TRUE( s.find( i, []( value_type const& v, value_type const& arg ) { - EXPECT_EQ( v.key(), arg.key() ); + EXPECT_EQ( v.key(), arg.key()); EXPECT_EQ( v.nVal, arg.nVal ); EXPECT_EQ( v.strVal, std::string( "Hello!" )); } )); break; case 8: str = "Hello!"; - EXPECT_TRUE( s.insert( value_type( i.key(), std::move( str ))) ); - EXPECT_TRUE( str.empty() ); + EXPECT_TRUE( s.insert( value_type( i.key(), std::move( str )))); + EXPECT_TRUE( str.empty()); EXPECT_TRUE( s.find( i, []( value_type const& v, value_type const& arg ) { - EXPECT_EQ( v.key(), arg.key() ); + EXPECT_EQ( v.key(), arg.key()); EXPECT_EQ( v.nVal, arg.nVal ); - EXPECT_EQ( v.strVal, std::string( "Hello!" ) ); - } ) ); + EXPECT_EQ( v.strVal, std::string( "Hello!" )); + } )); break; case 9: updResult = s.upsert( i.key(), false ); @@ -226,8 +226,8 @@ namespace cds_test { EXPECT_TRUE( s.find( i, []( value_type const& v, value_type const& arg ) { - EXPECT_EQ( v.key(), arg.key() ); - } ) ); + EXPECT_EQ( v.key(), arg.key()); + } )); break; case 10: updResult = s.upsert( i, false ); @@ -244,36 +244,36 @@ namespace cds_test { EXPECT_TRUE( s.find( i, []( value_type const& v, value_type const& arg ) { - EXPECT_EQ( v.key(), arg.key() ); - } ) ); + EXPECT_EQ( v.key(), arg.key()); + } )); break; default: // forgot anything?.. EXPECT_TRUE( false ); } - EXPECT_TRUE( s.contains( i.nKey ) ); - EXPECT_TRUE( s.contains( i ) ); - EXPECT_TRUE( s.contains( other_item( i.key() ), other_less() ) ); - EXPECT_TRUE( s.find( i.nKey, []( value_type&, int ) {} ) ); - EXPECT_TRUE( s.find( i, []( value_type&, value_type const& ) {} ) ); - EXPECT_TRUE( s.find_with( other_item( i.key() ), other_less(), []( value_type&, other_item const& ) {} ) ); + EXPECT_TRUE( s.contains( i.nKey )); + EXPECT_TRUE( s.contains( i )); + EXPECT_TRUE( s.contains( other_item( i.key()), other_less()) ); + EXPECT_TRUE( s.find( i.nKey, []( value_type&, int ) {} )); + EXPECT_TRUE( s.find( i, []( value_type&, value_type const& ) {} )); + EXPECT_TRUE( s.find_with( other_item( i.key()), other_less(), []( value_type&, other_item const& ) {} )); EXPECT_FALSE( s.find( i.nKey ) == s.end()); - EXPECT_FALSE( s.find( i ) == s.end() ); - EXPECT_FALSE( s.find_with( other_item( i.key() ), other_less()) == s.end() ); + EXPECT_FALSE( s.find( i ) == s.end()); + EXPECT_FALSE( s.find_with( other_item( i.key()), other_less()) == s.end()); } - EXPECT_FALSE( s.empty() ); + EXPECT_FALSE( s.empty()); EXPECT_CONTAINER_SIZE( s, nSetSize ); // erase - shuffle( indices.begin(), indices.end() ); + shuffle( indices.begin(), indices.end()); for ( auto idx : indices ) { auto& i = data[idx]; - EXPECT_TRUE( s.contains( i.nKey ) ); - EXPECT_TRUE( s.contains( i ) ); - EXPECT_TRUE( s.contains( other_item( i.key() ), other_less() ) ); + EXPECT_TRUE( s.contains( i.nKey )); + EXPECT_TRUE( s.contains( i )); + EXPECT_TRUE( s.contains( other_item( i.key()), other_less()) ); EXPECT_TRUE( s.find( i.nKey, []( value_type& v, int ) { v.nFindCount = 1; @@ -282,7 +282,7 @@ namespace cds_test { { EXPECT_EQ( ++v.nFindCount, 2u ); })); - EXPECT_TRUE( s.find_with( other_item( i.key() ), other_less(), []( value_type& v, other_item const& ) + EXPECT_TRUE( s.find_with( other_item( i.key()), other_less(), []( value_type& v, other_item const& ) { EXPECT_EQ( ++v.nFindCount, 3u ); })); @@ -299,7 +299,7 @@ namespace cds_test { break; case 2: EXPECT_TRUE( s.erase_with( other_item( i.key()), other_less())); - EXPECT_FALSE( s.erase_with( other_item( i.key() ), other_less() ) ); + EXPECT_FALSE( s.erase_with( other_item( i.key()), other_less()) ); break; case 3: EXPECT_TRUE( s.erase( i.key(), [&nKey]( value_type const& v ) @@ -345,32 +345,32 @@ namespace cds_test { break; } - EXPECT_FALSE( s.contains( i.nKey ) ); - EXPECT_FALSE( s.contains( i ) ); - EXPECT_FALSE( s.contains( other_item( i.key() ), other_less())); + EXPECT_FALSE( s.contains( i.nKey )); + EXPECT_FALSE( s.contains( i )); + EXPECT_FALSE( s.contains( other_item( i.key()), other_less())); EXPECT_FALSE( s.find( i.nKey, []( value_type&, int ) {} )); EXPECT_FALSE( s.find( i, []( value_type&, value_type const& ) {} )); EXPECT_FALSE( s.find_with( other_item( i.key()), other_less(), []( value_type&, other_item const& ) {} )); } - EXPECT_TRUE( s.empty() ); + EXPECT_TRUE( s.empty()); EXPECT_CONTAINER_SIZE( s, 0u ); // clear for ( auto& i : data ) { - EXPECT_TRUE( s.insert( i ) ); + EXPECT_TRUE( s.insert( i )); } - EXPECT_FALSE( s.empty() ); + EXPECT_FALSE( s.empty()); EXPECT_CONTAINER_SIZE( s, nSetSize ); s.clear(); - EXPECT_TRUE( s.empty() ); + EXPECT_TRUE( s.empty()); EXPECT_CONTAINER_SIZE( s, 0u ); - EXPECT_TRUE( s.begin() == s.end() ); - EXPECT_TRUE( s.cbegin() == s.cend() ); + EXPECT_TRUE( s.begin() == s.end()); + EXPECT_TRUE( s.cbegin() == s.cend()); } }; diff --git a/test/unit/set/test_michael_iterable_hp.h b/test/unit/set/test_michael_iterable_hp.h index a9f20ca8..ba0679b9 100644 --- a/test/unit/set/test_michael_iterable_hp.h +++ b/test/unit/set/test_michael_iterable_hp.h @@ -46,7 +46,7 @@ namespace cds_test { // Precondition: set is empty // Postcondition: set is empty - EXPECT_TRUE( s.empty() ); + EXPECT_TRUE( s.empty()); EXPECT_CONTAINER_SIZE( s, 0 ); base_class::test( s ); @@ -59,15 +59,15 @@ namespace cds_test { data.reserve( kSize ); indices.reserve( kSize ); for ( size_t key = 0; key < kSize; ++key ) { - data.push_back( value_type( static_cast(key) ) ); + data.push_back( value_type( static_cast(key)) ); indices.push_back( key ); } - shuffle( indices.begin(), indices.end() ); + shuffle( indices.begin(), indices.end()); for ( auto& i : data ) { - EXPECT_TRUE( s.insert( i ) ); + EXPECT_TRUE( s.insert( i )); } - EXPECT_FALSE( s.empty() ); + EXPECT_FALSE( s.empty()); EXPECT_CONTAINER_SIZE( s, nSetSize ); // iterator test @@ -89,7 +89,7 @@ namespace cds_test { EXPECT_TRUE( !gp ); switch ( idx % 3 ) { case 0: - gp = s.get( i.key() ); + gp = s.get( i.key()); ASSERT_FALSE( !gp ); break; case 1: @@ -97,10 +97,10 @@ namespace cds_test { ASSERT_FALSE( !gp ); break; case 2: - gp = s.get_with( other_item( i.key() ), other_less() ); + gp = s.get_with( other_item( i.key()), other_less()); ASSERT_FALSE( !gp ); } - EXPECT_EQ( gp->key(), i.key() ); + EXPECT_EQ( gp->key(), i.key()); EXPECT_EQ( gp->nFindCount, static_cast( i.key() * 3 )); gp->nFindCount *= 2; @@ -114,7 +114,7 @@ namespace cds_test { EXPECT_TRUE( !gp ); switch ( idx % 3 ) { case 0: - gp = s.extract( i.key() ); + gp = s.extract( i.key()); ASSERT_FALSE( !gp ); break; case 1: @@ -122,28 +122,28 @@ namespace cds_test { ASSERT_FALSE( !gp ); break; case 2: - gp = s.extract_with( other_item( i.key() ), other_less() ); + gp = s.extract_with( other_item( i.key()), other_less()); ASSERT_FALSE( !gp ); break; } - EXPECT_EQ( gp->key(), i.key() ); + EXPECT_EQ( gp->key(), i.key()); EXPECT_EQ( gp->nFindCount, static_cast( i.key() * 6 )); switch ( idx % 3 ) { case 0: - gp = s.extract( i.key() ); + gp = s.extract( i.key()); break; case 1: gp = s.extract( i ); break; case 2: - gp = s.extract_with( other_item( i.key() ), other_less() ); + gp = s.extract_with( other_item( i.key()), other_less()); break; } EXPECT_TRUE( !gp ); } - EXPECT_TRUE( s.empty() ); + EXPECT_TRUE( s.empty()); EXPECT_CONTAINER_SIZE( s, 0 ); } diff --git a/test/unit/set/test_ordered_set_hp.h b/test/unit/set/test_ordered_set_hp.h index 7a232ba4..cc562c99 100644 --- a/test/unit/set/test_ordered_set_hp.h +++ b/test/unit/set/test_ordered_set_hp.h @@ -48,7 +48,7 @@ namespace cds_test { base_class::test( s ); - ASSERT_TRUE( s.empty() ); + ASSERT_TRUE( s.empty()); ASSERT_CONTAINER_SIZE( s, 0 ); typedef typename Set::value_type value_type; @@ -59,15 +59,15 @@ namespace cds_test { data.reserve( kSize ); indices.reserve( kSize ); for ( size_t key = 0; key < kSize; ++key ) { - data.push_back( value_type( static_cast(key) ) ); + data.push_back( value_type( static_cast(key)) ); indices.push_back( key ); } - shuffle( indices.begin(), indices.end() ); + shuffle( indices.begin(), indices.end()); for ( auto i : indices ) { ASSERT_TRUE( s.insert( data[i] )); } - ASSERT_FALSE( s.empty() ); + ASSERT_FALSE( s.empty()); ASSERT_CONTAINER_SIZE( s, nSetSize ); typedef typename Set::guarded_ptr guarded_ptr; @@ -76,7 +76,7 @@ namespace cds_test { // extract_min size_t nCount = 0; int nKey = -1; - while ( !s.empty() ) { + while ( !s.empty()) { gp = s.extract_min(); ASSERT_FALSE( !gp ); EXPECT_EQ( nKey + 1, gp->key()); @@ -86,19 +86,19 @@ namespace cds_test { gp.release(); EXPECT_EQ( nCount, nSetSize ); - ASSERT_TRUE( s.empty() ); + ASSERT_TRUE( s.empty()); ASSERT_CONTAINER_SIZE( s, 0 ); // extract_max for ( auto i : indices ) { - ASSERT_TRUE( s.insert( data[i] ) ); + ASSERT_TRUE( s.insert( data[i] )); } - ASSERT_FALSE( s.empty() ); + ASSERT_FALSE( s.empty()); ASSERT_CONTAINER_SIZE( s, nSetSize ); nCount = 0; nKey = nSetSize; - while ( !s.empty() ) { + while ( !s.empty()) { gp = s.extract_max(); ASSERT_FALSE( !gp ); EXPECT_EQ( nKey - 1, gp->key()); @@ -108,7 +108,7 @@ namespace cds_test { gp.release(); EXPECT_EQ( nCount, nSetSize ); - ASSERT_TRUE( s.empty() ); + ASSERT_TRUE( s.empty()); ASSERT_CONTAINER_SIZE( s, 0 ); } }; diff --git a/test/unit/set/test_set.h b/test/unit/set/test_set.h index 31f1e5e3..946e605a 100644 --- a/test/unit/set/test_set.h +++ b/test/unit/set/test_set.h @@ -46,7 +46,7 @@ namespace cds_test { // Precondition: set is empty // Postcondition: set is empty - ASSERT_TRUE( s.empty() ); + ASSERT_TRUE( s.empty()); ASSERT_CONTAINER_SIZE( s, 0 ); size_t const nSetSize = kSize; @@ -57,18 +57,18 @@ namespace cds_test { data.reserve( kSize ); indices.reserve( kSize ); for ( size_t key = 0; key < kSize; ++key ) { - data.push_back( value_type( static_cast(key) ) ); + data.push_back( value_type( static_cast(key)) ); indices.push_back( key ); } - shuffle( indices.begin(), indices.end() ); + shuffle( indices.begin(), indices.end()); // insert/find for ( auto idx : indices ) { auto& i = data[idx]; - ASSERT_FALSE( s.contains( i.nKey ) ); - ASSERT_FALSE( s.contains( i ) ); - ASSERT_FALSE( s.contains( other_item( i.key() ), other_less())); + ASSERT_FALSE( s.contains( i.nKey )); + ASSERT_FALSE( s.contains( i )); + ASSERT_FALSE( s.contains( other_item( i.key()), other_less())); ASSERT_FALSE( s.find( i.nKey, []( value_type&, int ) {} )); ASSERT_FALSE( s.find( i, []( value_type&, value_type const& ) {} )); ASSERT_FALSE( s.find_with( other_item( i.key()), other_less(), []( value_type&, other_item const& ) {} )); @@ -90,14 +90,14 @@ namespace cds_test { updResult = s.update( i, []( bool bNew, value_type& val, value_type const& arg) { EXPECT_FALSE( bNew ); - EXPECT_EQ( val.key(), arg.key() ); + EXPECT_EQ( val.key(), arg.key()); }, false ); EXPECT_TRUE( updResult.first ); EXPECT_FALSE( updResult.second ); break; case 1: - ASSERT_TRUE( s.insert( i.key() )); - ASSERT_FALSE( s.insert( i.key() )); + ASSERT_TRUE( s.insert( i.key())); + ASSERT_FALSE( s.insert( i.key())); updResult = s.update( i.key(), []( bool bNew, value_type& val, int arg) { EXPECT_FALSE( bNew ); @@ -128,7 +128,7 @@ namespace cds_test { updResult = s.update( i, []( bool bNew, value_type& v, value_type const& arg ) { EXPECT_TRUE( bNew ); - EXPECT_EQ( v.key(), arg.key() ); + EXPECT_EQ( v.key(), arg.key()); ++v.nUpdateNewCount; }); EXPECT_TRUE( updResult.first ); @@ -137,7 +137,7 @@ namespace cds_test { updResult = s.update( i, []( bool bNew, value_type& v, value_type const& arg ) { EXPECT_FALSE( bNew ); - EXPECT_EQ( v.key(), arg.key() ); + EXPECT_EQ( v.key(), arg.key()); ++v.nUpdateNewCount; }, false ); EXPECT_TRUE( updResult.first ); @@ -170,7 +170,7 @@ namespace cds_test { ASSERT_TRUE( s.find( i, []( value_type const& v, value_type const& arg ) { - EXPECT_EQ( v.key(), arg.key() ); + EXPECT_EQ( v.key(), arg.key()); EXPECT_EQ( v.nUpdateNewCount, 2u ); })); break; @@ -178,7 +178,7 @@ namespace cds_test { ASSERT_TRUE( s.emplace( i.key())); ASSERT_TRUE( s.find( i, []( value_type const& v, value_type const& arg ) { - EXPECT_EQ( v.key(), arg.key() ); + EXPECT_EQ( v.key(), arg.key()); EXPECT_EQ( v.nVal, arg.nVal ); })); break; @@ -188,35 +188,35 @@ namespace cds_test { EXPECT_TRUE( str.empty()); ASSERT_TRUE( s.find( i, []( value_type const& v, value_type const& arg ) { - EXPECT_EQ( v.key(), arg.key() ); + EXPECT_EQ( v.key(), arg.key()); EXPECT_EQ( v.nVal, arg.nVal ); EXPECT_EQ( v.strVal, std::string( "Hello!" )); - } ) ); + } )); break; default: // forgot anything?.. ASSERT_TRUE( false ); } - ASSERT_TRUE( s.contains( i.nKey ) ); - ASSERT_TRUE( s.contains( i ) ); - ASSERT_TRUE( s.contains( other_item( i.key() ), other_less() ) ); - ASSERT_TRUE( s.find( i.nKey, []( value_type&, int ) {} ) ); - ASSERT_TRUE( s.find( i, []( value_type&, value_type const& ) {} ) ); - ASSERT_TRUE( s.find_with( other_item( i.key() ), other_less(), []( value_type&, other_item const& ) {} ) ); + ASSERT_TRUE( s.contains( i.nKey )); + ASSERT_TRUE( s.contains( i )); + ASSERT_TRUE( s.contains( other_item( i.key()), other_less()) ); + ASSERT_TRUE( s.find( i.nKey, []( value_type&, int ) {} )); + ASSERT_TRUE( s.find( i, []( value_type&, value_type const& ) {} )); + ASSERT_TRUE( s.find_with( other_item( i.key()), other_less(), []( value_type&, other_item const& ) {} )); } - ASSERT_FALSE( s.empty() ); + ASSERT_FALSE( s.empty()); ASSERT_CONTAINER_SIZE( s, nSetSize ); // erase - shuffle( indices.begin(), indices.end() ); + shuffle( indices.begin(), indices.end()); for ( auto idx : indices ) { auto& i = data[idx]; - ASSERT_TRUE( s.contains( i.nKey ) ); - ASSERT_TRUE( s.contains( i ) ); - ASSERT_TRUE( s.contains( other_item( i.key() ), other_less() ) ); + ASSERT_TRUE( s.contains( i.nKey )); + ASSERT_TRUE( s.contains( i )); + ASSERT_TRUE( s.contains( other_item( i.key()), other_less()) ); ASSERT_TRUE( s.find( i.nKey, []( value_type& v, int ) { v.nFindCount = 1; @@ -225,7 +225,7 @@ namespace cds_test { { EXPECT_EQ( ++v.nFindCount, 2u ); })); - ASSERT_TRUE( s.find_with( other_item( i.key() ), other_less(), []( value_type& v, other_item const& ) + ASSERT_TRUE( s.find_with( other_item( i.key()), other_less(), []( value_type& v, other_item const& ) { EXPECT_EQ( ++v.nFindCount, 3u ); })); @@ -242,7 +242,7 @@ namespace cds_test { break; case 2: ASSERT_TRUE( s.erase_with( other_item( i.key()), other_less())); - ASSERT_FALSE( s.erase_with( other_item( i.key() ), other_less() ) ); + ASSERT_FALSE( s.erase_with( other_item( i.key()), other_less()) ); break; case 3: ASSERT_TRUE( s.erase( i.key(), [&nKey]( value_type const& v ) @@ -288,32 +288,32 @@ namespace cds_test { break; } - ASSERT_FALSE( s.contains( i.nKey ) ); - ASSERT_FALSE( s.contains( i ) ); - ASSERT_FALSE( s.contains( other_item( i.key() ), other_less())); + ASSERT_FALSE( s.contains( i.nKey )); + ASSERT_FALSE( s.contains( i )); + ASSERT_FALSE( s.contains( other_item( i.key()), other_less())); ASSERT_FALSE( s.find( i.nKey, []( value_type&, int ) {} )); ASSERT_FALSE( s.find( i, []( value_type&, value_type const& ) {} )); ASSERT_FALSE( s.find_with( other_item( i.key()), other_less(), []( value_type&, other_item const& ) {} )); } - ASSERT_TRUE( s.empty() ); + ASSERT_TRUE( s.empty()); ASSERT_CONTAINER_SIZE( s, 0u ); // clear for ( auto& i : data ) { - ASSERT_TRUE( s.insert( i ) ); + ASSERT_TRUE( s.insert( i )); } - ASSERT_FALSE( s.empty() ); + ASSERT_FALSE( s.empty()); ASSERT_CONTAINER_SIZE( s, nSetSize ); s.clear(); - ASSERT_TRUE( s.empty() ); + ASSERT_TRUE( s.empty()); ASSERT_CONTAINER_SIZE( s, 0u ); - ASSERT_TRUE( s.begin() == s.end() ); - ASSERT_TRUE( s.cbegin() == s.cend() ); + ASSERT_TRUE( s.begin() == s.end()); + ASSERT_TRUE( s.cbegin() == s.cend()); } }; diff --git a/test/unit/set/test_set_data.h b/test/unit/set/test_set_data.h index 00fc3e2a..23676c1d 100644 --- a/test/unit/set/test_set_data.h +++ b/test/unit/set/test_set_data.h @@ -61,7 +61,7 @@ namespace cds_test { void clear_stat() { - memset( this, 0, sizeof( *this ) ); + memset( this, 0, sizeof( *this )); } }; @@ -96,7 +96,7 @@ namespace cds_test { template explicit int_item( Q const& src ) - : nKey( src.key() ) + : nKey( src.key()) , nVal( 0 ) {} @@ -109,17 +109,17 @@ namespace cds_test { int_item( int_item&& src ) : nKey( src.nKey ) , nVal( src.nVal ) - , strVal( std::move( src.strVal ) ) + , strVal( std::move( src.strVal )) {} int_item( int k, std::string&& s ) : nKey( k ) , nVal( k * 2 ) - , strVal( std::move( s ) ) + , strVal( std::move( s )) {} explicit int_item( other_item const& s ) - : nKey( s.key() ) + : nKey( s.key()) , nVal( s.key() * 2 ) {} @@ -193,7 +193,7 @@ namespace cds_test { struct cmp { int operator ()( int_item const& v1, int_item const& v2 ) const { - if ( v1.key() < v2.key() ) + if ( v1.key() < v2.key()) return -1; return v1.key() > v2.key() ? 1 : 0; } @@ -209,7 +209,7 @@ namespace cds_test { template int operator ()( int v1, T const& v2 ) const { - if ( v1 < v2.key() ) + if ( v1 < v2.key()) return -1; return v1 > v2.key() ? 1 : 0; } diff --git a/test/unit/set/test_set_hp.h b/test/unit/set/test_set_hp.h index 3f099fad..03f1c270 100644 --- a/test/unit/set/test_set_hp.h +++ b/test/unit/set/test_set_hp.h @@ -46,7 +46,7 @@ namespace cds_test { // Precondition: set is empty // Postcondition: set is empty - ASSERT_TRUE( s.empty() ); + ASSERT_TRUE( s.empty()); ASSERT_CONTAINER_SIZE( s, 0 ); base_class::test( s ); @@ -59,15 +59,15 @@ namespace cds_test { data.reserve( kSize ); indices.reserve( kSize ); for ( size_t key = 0; key < kSize; ++key ) { - data.push_back( value_type( static_cast(key) ) ); + data.push_back( value_type( static_cast(key)) ); indices.push_back( key ); } - shuffle( indices.begin(), indices.end() ); + shuffle( indices.begin(), indices.end()); for ( auto& i : data ) { - ASSERT_TRUE( s.insert( i ) ); + ASSERT_TRUE( s.insert( i )); } - ASSERT_FALSE( s.empty() ); + ASSERT_FALSE( s.empty()); ASSERT_CONTAINER_SIZE( s, nSetSize ); // iterator test @@ -89,7 +89,7 @@ namespace cds_test { ASSERT_TRUE( !gp ); switch ( idx % 3 ) { case 0: - gp = s.get( i.key() ); + gp = s.get( i.key()); ASSERT_FALSE( !gp ); break; case 1: @@ -97,10 +97,10 @@ namespace cds_test { ASSERT_FALSE( !gp ); break; case 2: - gp = s.get_with( other_item( i.key() ), other_less() ); + gp = s.get_with( other_item( i.key()), other_less()); ASSERT_FALSE( !gp ); } - EXPECT_EQ( gp->key(), i.key() ); + EXPECT_EQ( gp->key(), i.key()); EXPECT_EQ( gp->nFindCount, static_cast( i.key() * 3 )); gp->nFindCount *= 2; @@ -114,7 +114,7 @@ namespace cds_test { ASSERT_TRUE( !gp ); switch ( idx % 3 ) { case 0: - gp = s.extract( i.key() ); + gp = s.extract( i.key()); ASSERT_FALSE( !gp ); break; case 1: @@ -122,28 +122,28 @@ namespace cds_test { ASSERT_FALSE( !gp ); break; case 2: - gp = s.extract_with( other_item( i.key() ), other_less() ); + gp = s.extract_with( other_item( i.key()), other_less()); ASSERT_FALSE( !gp ); break; } - EXPECT_EQ( gp->key(), i.key() ); + EXPECT_EQ( gp->key(), i.key()); EXPECT_EQ( gp->nFindCount, static_cast( i.key() * 6 )); switch ( idx % 3 ) { case 0: - gp = s.extract( i.key() ); + gp = s.extract( i.key()); break; case 1: gp = s.extract( i ); break; case 2: - gp = s.extract_with( other_item( i.key() ), other_less() ); + gp = s.extract_with( other_item( i.key()), other_less()); break; } ASSERT_TRUE( !gp ); } - ASSERT_TRUE( s.empty() ); + ASSERT_TRUE( s.empty()); ASSERT_CONTAINER_SIZE( s, 0 ); } diff --git a/test/unit/set/test_set_nogc.h b/test/unit/set/test_set_nogc.h index ef4567c7..7eb805d9 100644 --- a/test/unit/set/test_set_nogc.h +++ b/test/unit/set/test_set_nogc.h @@ -60,7 +60,7 @@ namespace cds_test { void clear_stat() { - memset( this, 0, sizeof( *this ) ); + memset( this, 0, sizeof( *this )); } }; @@ -95,7 +95,7 @@ namespace cds_test { template explicit int_item( Q const& src ) - : nKey( src.key() ) + : nKey( src.key()) , nVal( 0 ) {} @@ -108,17 +108,17 @@ namespace cds_test { int_item( int_item&& src ) : nKey( src.nKey ) , nVal( src.nVal ) - , strVal( std::move( src.strVal ) ) + , strVal( std::move( src.strVal )) {} int_item( int k, std::string&& s ) : nKey( k ) , nVal( k * 2 ) - , strVal( std::move( s ) ) + , strVal( std::move( s )) {} explicit int_item( other_item const& s ) - : nKey( s.key() ) + : nKey( s.key()) , nVal( s.key() * 2 ) {} @@ -192,7 +192,7 @@ namespace cds_test { struct cmp { int operator ()( int_item const& v1, int_item const& v2 ) const { - if ( v1.key() < v2.key() ) + if ( v1.key() < v2.key()) return -1; return v1.key() > v2.key() ? 1 : 0; } @@ -208,7 +208,7 @@ namespace cds_test { template int operator ()( int v1, T const& v2 ) const { - if ( v1 < v2.key() ) + if ( v1 < v2.key()) return -1; return v1 > v2.key() ? 1 : 0; } @@ -229,7 +229,7 @@ namespace cds_test { // Precondition: set is empty // Postcondition: set is empty - ASSERT_TRUE( s.empty() ); + ASSERT_TRUE( s.empty()); ASSERT_CONTAINER_SIZE( s, 0 ); size_t const nSetSize = kSize; @@ -240,18 +240,18 @@ namespace cds_test { data.reserve( kSize ); indices.reserve( kSize ); for ( size_t key = 0; key < kSize; ++key ) { - data.push_back( value_type( static_cast(key) ) ); + data.push_back( value_type( static_cast(key)) ); indices.push_back( key ); } - shuffle( indices.begin(), indices.end() ); + shuffle( indices.begin(), indices.end()); // insert/find for ( auto idx : indices ) { auto& i = data[idx]; - ASSERT_FALSE( s.contains( i.nKey ) != s.end() ); - ASSERT_FALSE( s.contains( i ) != s.end() ); - ASSERT_FALSE( s.contains( other_item( i.key() ), other_less()) != s.end()); + ASSERT_FALSE( s.contains( i.nKey ) != s.end()); + ASSERT_FALSE( s.contains( i ) != s.end()); + ASSERT_FALSE( s.contains( other_item( i.key()), other_less()) != s.end()); std::pair updResult; @@ -264,7 +264,7 @@ namespace cds_test { switch ( idx % 6 ) { case 0: it = s.insert( i ); - ASSERT_TRUE( it != s.end() ); + ASSERT_TRUE( it != s.end()); it->nFindCount = it->nKey; ASSERT_TRUE( s.insert( i ) == s.end()); updResult = s.update( i, false ); @@ -272,9 +272,9 @@ namespace cds_test { EXPECT_FALSE( updResult.second ); break; case 1: - it = s.insert( i.key() ); + it = s.insert( i.key()); ASSERT_TRUE( it != s.end()); - ASSERT_TRUE( s.insert( i.key() ) == s.end()); + ASSERT_TRUE( s.insert( i.key()) == s.end()); it->nFindCount = it->nKey; updResult = s.update( i.key(), false ); EXPECT_TRUE( updResult.first == it ); @@ -288,7 +288,7 @@ namespace cds_test { break; case 3: updResult = s.update( i.key()); - EXPECT_TRUE( updResult.first != s.end() ); + EXPECT_TRUE( updResult.first != s.end()); EXPECT_TRUE( updResult.second ); updResult.first->nFindCount = updResult.first->nKey; break; @@ -296,17 +296,17 @@ namespace cds_test { it = s.emplace( i.key()); ASSERT_TRUE( it != s.end()); it->nFindCount = it->nKey; - ASSERT_FALSE( s.emplace( i.key() ) != s.end()); + ASSERT_FALSE( s.emplace( i.key()) != s.end()); break; case 5: str = "Hello!"; it = s.emplace( i.key(), std::move( str )); - ASSERT_TRUE( it != s.end() ); + ASSERT_TRUE( it != s.end()); EXPECT_TRUE( str.empty()); it->nFindCount = it->nKey; str = "Hello!"; ASSERT_TRUE( s.emplace( i.key(), std::move( str )) == s.end()); - EXPECT_TRUE( str.empty() ); // yes, that's is :( + EXPECT_TRUE( str.empty()); // yes, that's is :( break; default: // forgot anything?.. @@ -314,13 +314,13 @@ namespace cds_test { } it = s.contains( i.nKey ); - ASSERT_TRUE( it != s.end() ); + ASSERT_TRUE( it != s.end()); EXPECT_EQ( it->nFindCount, static_cast( it->nKey )); - ASSERT_TRUE( s.contains( i ) != s.end() ); - ASSERT_TRUE( s.contains( other_item( i.key() ), other_less() ) != s.end()); + ASSERT_TRUE( s.contains( i ) != s.end()); + ASSERT_TRUE( s.contains( other_item( i.key()), other_less()) != s.end()); } - ASSERT_FALSE( s.empty() ); + ASSERT_FALSE( s.empty()); ASSERT_CONTAINER_SIZE( s, nSetSize ); // iterators @@ -336,11 +336,11 @@ namespace cds_test { s.clear(); - ASSERT_TRUE( s.empty() ); + ASSERT_TRUE( s.empty()); ASSERT_CONTAINER_SIZE( s, 0 ); - ASSERT_TRUE( s.begin() == s.end() ); - ASSERT_TRUE( s.cbegin() == s.cend() ); + ASSERT_TRUE( s.begin() == s.end()); + ASSERT_TRUE( s.cbegin() == s.cend()); } }; diff --git a/test/unit/set/test_set_rcu.h b/test/unit/set/test_set_rcu.h index 876972ac..4d039978 100644 --- a/test/unit/set/test_set_rcu.h +++ b/test/unit/set/test_set_rcu.h @@ -46,7 +46,7 @@ namespace cds_test { // Precondition: set is empty // Postcondition: set is empty - ASSERT_TRUE( s.empty() ); + ASSERT_TRUE( s.empty()); ASSERT_CONTAINER_SIZE( s, 0 ); base_class::test( s ); @@ -59,15 +59,15 @@ namespace cds_test { data.reserve( kSize ); indices.reserve( kSize ); for ( size_t key = 0; key < kSize; ++key ) { - data.push_back( value_type( static_cast(key) ) ); + data.push_back( value_type( static_cast(key)) ); indices.push_back( key ); } - shuffle( indices.begin(), indices.end() ); + shuffle( indices.begin(), indices.end()); for ( auto& i : data ) { - ASSERT_TRUE( s.insert( i ) ); + ASSERT_TRUE( s.insert( i )); } - ASSERT_FALSE( s.empty() ); + ASSERT_FALSE( s.empty()); ASSERT_CONTAINER_SIZE( s, nSetSize ); // iterator test @@ -93,7 +93,7 @@ namespace cds_test { ASSERT_TRUE( !rp ); switch ( idx % 3 ) { case 0: - rp = s.get( i.key() ); + rp = s.get( i.key()); ASSERT_FALSE( !rp ); break; case 1: @@ -101,10 +101,10 @@ namespace cds_test { ASSERT_FALSE( !rp ); break; case 2: - rp = s.get_with( other_item( i.key() ), other_less() ); + rp = s.get_with( other_item( i.key()), other_less()); ASSERT_FALSE( !rp ); } - EXPECT_EQ( rp->key(), i.key() ); + EXPECT_EQ( rp->key(), i.key()); EXPECT_EQ( rp->nFindCount, static_cast( i.key() * 3 )); rp->nFindCount *= 2; } @@ -122,7 +122,7 @@ namespace cds_test { switch ( idx % 3 ) { case 0: - xp = s.extract( i.key() ); + xp = s.extract( i.key()); ASSERT_FALSE( !xp ); break; case 1: @@ -130,11 +130,11 @@ namespace cds_test { ASSERT_FALSE( !xp ); break; case 2: - xp = s.extract_with( other_item( i.key() ), other_less() ); + xp = s.extract_with( other_item( i.key()), other_less()); ASSERT_FALSE( !xp ); break; } - EXPECT_EQ( xp->key(), i.key() ); + EXPECT_EQ( xp->key(), i.key()); EXPECT_EQ( xp->nFindCount, static_cast( i.key() * 6 )); } xp.release(); @@ -144,13 +144,13 @@ namespace cds_test { switch ( idx % 3 ) { case 0: - xp = s.extract( i.key() ); + xp = s.extract( i.key()); break; case 1: xp = s.extract( i ); break; case 2: - xp = s.extract_with( other_item( i.key() ), other_less() ); + xp = s.extract_with( other_item( i.key()), other_less()); break; } ASSERT_TRUE( !xp ); @@ -159,7 +159,7 @@ namespace cds_test { else { switch ( idx % 3 ) { case 0: - xp = s.extract( i.key() ); + xp = s.extract( i.key()); ASSERT_FALSE( !xp ); break; case 1: @@ -167,29 +167,29 @@ namespace cds_test { ASSERT_FALSE( !xp ); break; case 2: - xp = s.extract_with( other_item( i.key() ), other_less() ); + xp = s.extract_with( other_item( i.key()), other_less()); ASSERT_FALSE( !xp ); break; } - EXPECT_EQ( xp->key(), i.key() ); + EXPECT_EQ( xp->key(), i.key()); EXPECT_EQ( xp->nFindCount, static_cast( i.key() * 6 )); switch ( idx % 3 ) { case 0: - xp = s.extract( i.key() ); + xp = s.extract( i.key()); break; case 1: xp = s.extract( i ); break; case 2: - xp = s.extract_with( other_item( i.key() ), other_less() ); + xp = s.extract_with( other_item( i.key()), other_less()); break; } ASSERT_TRUE( !xp ); } } - ASSERT_TRUE( s.empty() ); + ASSERT_TRUE( s.empty()); ASSERT_CONTAINER_SIZE( s, 0 ); } diff --git a/test/unit/set/test_skiplist_rcu.h b/test/unit/set/test_skiplist_rcu.h index ec5b1289..15220f76 100644 --- a/test/unit/set/test_skiplist_rcu.h +++ b/test/unit/set/test_skiplist_rcu.h @@ -51,7 +51,7 @@ protected: base_class::test( s ); - ASSERT_TRUE( s.empty() ); + ASSERT_TRUE( s.empty()); ASSERT_CONTAINER_SIZE( s, 0 ); typedef typename Set::value_type value_type; @@ -62,15 +62,15 @@ protected: data.reserve( nSetSize ); indices.reserve( nSetSize ); for ( size_t key = 0; key < nSetSize; ++key ) { - data.push_back( value_type( static_cast(key) ) ); + data.push_back( value_type( static_cast(key)) ); indices.push_back( key ); } - shuffle( indices.begin(), indices.end() ); + shuffle( indices.begin(), indices.end()); for ( auto i : indices ) { - ASSERT_TRUE( s.insert( data[i] ) ); + ASSERT_TRUE( s.insert( data[i] )); } - ASSERT_FALSE( s.empty() ); + ASSERT_FALSE( s.empty()); ASSERT_CONTAINER_SIZE( s, nSetSize ); typedef typename Set::exempt_ptr exempt_ptr; @@ -79,39 +79,39 @@ protected: // extract_min size_t nCount = 0; int nKey = -1; - while ( !s.empty() ) { + while ( !s.empty()) { xp = s.extract_min(); ASSERT_FALSE( !xp ); - EXPECT_EQ( nKey + 1, xp->key() ); + EXPECT_EQ( nKey + 1, xp->key()); ++nCount; nKey = xp->key(); } xp.release(); EXPECT_EQ( nCount, nSetSize ); - ASSERT_TRUE( s.empty() ); + ASSERT_TRUE( s.empty()); ASSERT_CONTAINER_SIZE( s, 0 ); // extract_max for ( auto i : indices ) { - ASSERT_TRUE( s.insert( data[i] ) ); + ASSERT_TRUE( s.insert( data[i] )); } - ASSERT_FALSE( s.empty() ); + ASSERT_FALSE( s.empty()); ASSERT_CONTAINER_SIZE( s, nSetSize ); nCount = 0; nKey = nSetSize; - while ( !s.empty() ) { + while ( !s.empty()) { xp = s.extract_max(); ASSERT_FALSE( !xp ); - EXPECT_EQ( nKey - 1, xp->key() ); + EXPECT_EQ( nKey - 1, xp->key()); ++nCount; nKey = xp->key(); } xp.release(); EXPECT_EQ( nCount, nSetSize ); - ASSERT_TRUE( s.empty() ); + ASSERT_TRUE( s.empty()); ASSERT_CONTAINER_SIZE( s, 0 ); } diff --git a/test/unit/set/test_split_iterable.h b/test/unit/set/test_split_iterable.h index 09c688c9..635682de 100644 --- a/test/unit/set/test_split_iterable.h +++ b/test/unit/set/test_split_iterable.h @@ -46,7 +46,7 @@ namespace cds_test { // Precondition: set is empty // Postcondition: set is empty - ASSERT_TRUE( s.empty() ); + ASSERT_TRUE( s.empty()); ASSERT_CONTAINER_SIZE( s, 0 ); size_t const nSetSize = kSize; @@ -57,25 +57,25 @@ namespace cds_test { data.reserve( kSize ); indices.reserve( kSize ); for ( size_t key = 0; key < kSize; ++key ) { - data.push_back( value_type( static_cast(key) ) ); + data.push_back( value_type( static_cast(key)) ); indices.push_back( key ); } - shuffle( indices.begin(), indices.end() ); + shuffle( indices.begin(), indices.end()); // insert/find for ( auto idx : indices ) { auto& i = data[idx]; - EXPECT_FALSE( s.contains( i.nKey ) ); - EXPECT_FALSE( s.contains( i ) ); - EXPECT_FALSE( s.contains( other_item( i.key() ), other_less())); + EXPECT_FALSE( s.contains( i.nKey )); + EXPECT_FALSE( s.contains( i )); + EXPECT_FALSE( s.contains( other_item( i.key()), other_less())); EXPECT_FALSE( s.find( i.nKey, []( value_type&, int ) {} )); EXPECT_FALSE( s.find( i, []( value_type&, value_type const& ) {} )); EXPECT_FALSE( s.find_with( other_item( i.key()), other_less(), []( value_type&, other_item const& ) {} )); - EXPECT_TRUE( s.find( i.nKey ) == s.end() ); - EXPECT_TRUE( s.find( i ) == s.end() ); - EXPECT_TRUE( s.find_with( other_item( i.key() ), other_less() ) == s.end() ); + EXPECT_TRUE( s.find( i.nKey ) == s.end()); + EXPECT_TRUE( s.find( i ) == s.end()); + EXPECT_TRUE( s.find_with( other_item( i.key()), other_less()) == s.end()); std::pair updResult; @@ -94,18 +94,18 @@ namespace cds_test { updResult = s.update( i, []( value_type& cur, value_type* old ) { EXPECT_FALSE( old == nullptr ); - EXPECT_EQ( cur.key(), old->key() ); + EXPECT_EQ( cur.key(), old->key()); }, false ); EXPECT_TRUE( updResult.first ); EXPECT_FALSE( updResult.second ); break; case 1: - EXPECT_TRUE( s.insert( i.key() )); - EXPECT_FALSE( s.insert( i.key() )); + EXPECT_TRUE( s.insert( i.key())); + EXPECT_FALSE( s.insert( i.key())); updResult = s.update( i.key(), []( value_type& cur, value_type* old ) { EXPECT_FALSE( old == nullptr ); - EXPECT_EQ( cur.key(), old->key() ); + EXPECT_EQ( cur.key(), old->key()); }, false ); EXPECT_TRUE( updResult.first ); EXPECT_FALSE( updResult.second ); @@ -140,7 +140,7 @@ namespace cds_test { updResult = s.update( i, []( value_type& v, value_type* old ) { EXPECT_FALSE( old == nullptr ); - EXPECT_EQ( v.key(), old->key() ); + EXPECT_EQ( v.key(), old->key()); v.nUpdateNewCount = old->nUpdateNewCount + 1; }, false ); EXPECT_TRUE( updResult.first ); @@ -156,7 +156,7 @@ namespace cds_test { updResult = s.update( i.key(), [&i]( value_type& v, value_type* old ) { EXPECT_TRUE( old == nullptr ); - EXPECT_EQ( i.key(), v.key() ); + EXPECT_EQ( i.key(), v.key()); ++v.nUpdateNewCount; }); EXPECT_TRUE( updResult.first ); @@ -165,7 +165,7 @@ namespace cds_test { updResult = s.update( i.key(), []( value_type& v, value_type* old ) { EXPECT_FALSE( old == nullptr ); - EXPECT_EQ( v.key(), old->key() ); + EXPECT_EQ( v.key(), old->key()); v.nUpdateNewCount = old->nUpdateNewCount + 1; }, false ); EXPECT_TRUE( updResult.first ); @@ -173,7 +173,7 @@ namespace cds_test { EXPECT_TRUE( s.find( i, []( value_type const& v, value_type const& arg ) { - EXPECT_EQ( v.key(), arg.key() ); + EXPECT_EQ( v.key(), arg.key()); EXPECT_EQ( v.nUpdateNewCount, 2u ); })); break; @@ -181,7 +181,7 @@ namespace cds_test { EXPECT_TRUE( s.emplace( i.key())); EXPECT_TRUE( s.find( i, []( value_type const& v, value_type const& arg ) { - EXPECT_EQ( v.key(), arg.key() ); + EXPECT_EQ( v.key(), arg.key()); EXPECT_EQ( v.nVal, arg.nVal ); })); break; @@ -191,25 +191,25 @@ namespace cds_test { EXPECT_TRUE( str.empty()); EXPECT_TRUE( s.find( i, []( value_type const& v, value_type const& arg ) { - EXPECT_EQ( v.key(), arg.key() ); + EXPECT_EQ( v.key(), arg.key()); EXPECT_EQ( v.nVal, arg.nVal ); EXPECT_EQ( v.strVal, std::string( "Hello!" )); - } ) ); + } )); break; case 8: { updResult = s.upsert( i.key(), false ); EXPECT_FALSE( updResult.first ); EXPECT_FALSE( updResult.second ); - EXPECT_TRUE( s.find( i.key() ) == s.end() ); + EXPECT_TRUE( s.find( i.key()) == s.end()); - updResult = s.upsert( i.key() ); + updResult = s.upsert( i.key()); EXPECT_TRUE( updResult.first ); EXPECT_TRUE( updResult.second ); - auto it = s.find( i.key() ); - ASSERT_FALSE( it == s.end() ); - EXPECT_EQ( it->key(), i.key() ); + auto it = s.find( i.key()); + ASSERT_FALSE( it == s.end()); + EXPECT_EQ( it->key(), i.key()); updResult = s.upsert( i.key(), false ); EXPECT_TRUE( updResult.first ); @@ -217,7 +217,7 @@ namespace cds_test { EXPECT_TRUE( s.find( i, []( value_type const& v, value_type const& arg ) { - EXPECT_EQ( v.key(), arg.key() ); + EXPECT_EQ( v.key(), arg.key()); } )); } break; @@ -226,15 +226,15 @@ namespace cds_test { updResult = s.upsert( i, false ); EXPECT_FALSE( updResult.first ); EXPECT_FALSE( updResult.second ); - EXPECT_TRUE( s.find( i ) == s.end() ); + EXPECT_TRUE( s.find( i ) == s.end()); updResult = s.upsert( i ); EXPECT_TRUE( updResult.first ); EXPECT_TRUE( updResult.second ); auto it = s.find( i ); - ASSERT_FALSE( it == s.end() ); - EXPECT_EQ( it->key(), i.key() ); + ASSERT_FALSE( it == s.end()); + EXPECT_EQ( it->key(), i.key()); updResult = s.upsert( i, false ); EXPECT_TRUE( updResult.first ); @@ -242,7 +242,7 @@ namespace cds_test { EXPECT_TRUE( s.find( i, []( value_type const& v, value_type const& arg ) { - EXPECT_EQ( v.key(), arg.key() ); + EXPECT_EQ( v.key(), arg.key()); } )); } break; @@ -252,33 +252,33 @@ namespace cds_test { ASSERT_TRUE( false ); } - EXPECT_TRUE( s.contains( i.nKey ) ); - EXPECT_TRUE( s.contains( i ) ); - EXPECT_TRUE( s.contains( other_item( i.key() ), other_less() ) ); - EXPECT_TRUE( s.find( i.nKey, []( value_type&, int ) {} ) ); - EXPECT_TRUE( s.find( i, []( value_type&, value_type const& ) {} ) ); - EXPECT_TRUE( s.find_with( other_item( i.key() ), other_less(), []( value_type&, other_item const& ) {} ) ); + EXPECT_TRUE( s.contains( i.nKey )); + EXPECT_TRUE( s.contains( i )); + EXPECT_TRUE( s.contains( other_item( i.key()), other_less()) ); + EXPECT_TRUE( s.find( i.nKey, []( value_type&, int ) {} )); + EXPECT_TRUE( s.find( i, []( value_type&, value_type const& ) {} )); + EXPECT_TRUE( s.find_with( other_item( i.key()), other_less(), []( value_type&, other_item const& ) {} )); auto it = s.find( i ); - ASSERT_FALSE( it == s.end() ); - EXPECT_EQ( it->key(), i.key() ); + ASSERT_FALSE( it == s.end()); + EXPECT_EQ( it->key(), i.key()); - it = s.find_with( other_item( i.key() ), other_less() ); - ASSERT_FALSE( it == s.end() ); - EXPECT_EQ( it->key(), i.key() ); + it = s.find_with( other_item( i.key()), other_less()); + ASSERT_FALSE( it == s.end()); + EXPECT_EQ( it->key(), i.key()); } - EXPECT_FALSE( s.empty() ); + EXPECT_FALSE( s.empty()); EXPECT_CONTAINER_SIZE( s, nSetSize ); // erase - shuffle( indices.begin(), indices.end() ); + shuffle( indices.begin(), indices.end()); for ( auto idx : indices ) { auto& i = data[idx]; - EXPECT_TRUE( s.contains( i.nKey ) ); - EXPECT_TRUE( s.contains( i ) ); - EXPECT_TRUE( s.contains( other_item( i.key() ), other_less() ) ); + EXPECT_TRUE( s.contains( i.nKey )); + EXPECT_TRUE( s.contains( i )); + EXPECT_TRUE( s.contains( other_item( i.key()), other_less()) ); EXPECT_TRUE( s.find( i.nKey, []( value_type& v, int ) { v.nFindCount = 1; @@ -287,17 +287,17 @@ namespace cds_test { { EXPECT_EQ( ++v.nFindCount, 2u ); })); - EXPECT_TRUE( s.find_with( other_item( i.key() ), other_less(), []( value_type& v, other_item const& ) + EXPECT_TRUE( s.find_with( other_item( i.key()), other_less(), []( value_type& v, other_item const& ) { EXPECT_EQ( ++v.nFindCount, 3u ); })); auto it = s.find( i ); - ASSERT_FALSE( it == s.end() ); - EXPECT_EQ( it->key(), i.key() ); - it = s.find_with( other_item( i.key() ), other_less() ); - ASSERT_FALSE( it == s.end() ); - EXPECT_EQ( it->key(), i.key() ); + ASSERT_FALSE( it == s.end()); + EXPECT_EQ( it->key(), i.key()); + it = s.find_with( other_item( i.key()), other_less()); + ASSERT_FALSE( it == s.end()); + EXPECT_EQ( it->key(), i.key()); int nKey = i.key() - 1; @@ -312,7 +312,7 @@ namespace cds_test { break; case 2: EXPECT_TRUE( s.erase_with( other_item( i.key()), other_less())); - EXPECT_FALSE( s.erase_with( other_item( i.key() ), other_less() ) ); + EXPECT_FALSE( s.erase_with( other_item( i.key()), other_less()) ); break; case 3: EXPECT_TRUE( s.erase( i.key(), [&nKey]( value_type const& v ) @@ -358,35 +358,35 @@ namespace cds_test { break; } - EXPECT_FALSE( s.contains( i.nKey ) ); - EXPECT_FALSE( s.contains( i ) ); - EXPECT_FALSE( s.contains( other_item( i.key() ), other_less())); + EXPECT_FALSE( s.contains( i.nKey )); + EXPECT_FALSE( s.contains( i )); + EXPECT_FALSE( s.contains( other_item( i.key()), other_less())); EXPECT_FALSE( s.find( i.nKey, []( value_type&, int ) {} )); EXPECT_FALSE( s.find( i, []( value_type&, value_type const& ) {} )); EXPECT_FALSE( s.find_with( other_item( i.key()), other_less(), []( value_type&, other_item const& ) {} )); - EXPECT_TRUE( s.find( i.nKey ) == s.end() ); - EXPECT_TRUE( s.find( i ) == s.end() ); - EXPECT_TRUE( s.find_with( other_item( i.key() ), other_less() ) == s.end() ); + EXPECT_TRUE( s.find( i.nKey ) == s.end()); + EXPECT_TRUE( s.find( i ) == s.end()); + EXPECT_TRUE( s.find_with( other_item( i.key()), other_less()) == s.end()); } - EXPECT_TRUE( s.empty() ); + EXPECT_TRUE( s.empty()); EXPECT_CONTAINER_SIZE( s, 0u ); // clear for ( auto& i : data ) { - EXPECT_TRUE( s.insert( i ) ); + EXPECT_TRUE( s.insert( i )); } - EXPECT_FALSE( s.empty() ); + EXPECT_FALSE( s.empty()); EXPECT_CONTAINER_SIZE( s, nSetSize ); s.clear(); - EXPECT_TRUE( s.empty() ); + EXPECT_TRUE( s.empty()); EXPECT_CONTAINER_SIZE( s, 0u ); - EXPECT_TRUE( s.begin() == s.end() ); - EXPECT_TRUE( s.cbegin() == s.cend() ); + EXPECT_TRUE( s.begin() == s.end()); + EXPECT_TRUE( s.cbegin() == s.cend()); } }; diff --git a/test/unit/set/test_split_iterable_hp.h b/test/unit/set/test_split_iterable_hp.h index 1e27a71d..4003f066 100644 --- a/test/unit/set/test_split_iterable_hp.h +++ b/test/unit/set/test_split_iterable_hp.h @@ -46,7 +46,7 @@ namespace cds_test { // Precondition: set is empty // Postcondition: set is empty - ASSERT_TRUE( s.empty() ); + ASSERT_TRUE( s.empty()); ASSERT_CONTAINER_SIZE( s, 0 ); base_class::test( s ); @@ -59,15 +59,15 @@ namespace cds_test { data.reserve( kSize ); indices.reserve( kSize ); for ( size_t key = 0; key < kSize; ++key ) { - data.push_back( value_type( static_cast(key) ) ); + data.push_back( value_type( static_cast(key)) ); indices.push_back( key ); } - shuffle( indices.begin(), indices.end() ); + shuffle( indices.begin(), indices.end()); for ( auto& i : data ) { - EXPECT_TRUE( s.insert( i ) ); + EXPECT_TRUE( s.insert( i )); } - EXPECT_FALSE( s.empty() ); + EXPECT_FALSE( s.empty()); EXPECT_CONTAINER_SIZE( s, nSetSize ); // iterator test @@ -89,7 +89,7 @@ namespace cds_test { EXPECT_TRUE( !gp ); switch ( idx % 3 ) { case 0: - gp = s.get( i.key() ); + gp = s.get( i.key()); ASSERT_FALSE( !gp ); break; case 1: @@ -97,10 +97,10 @@ namespace cds_test { ASSERT_FALSE( !gp ); break; case 2: - gp = s.get_with( other_item( i.key() ), other_less() ); + gp = s.get_with( other_item( i.key()), other_less()); ASSERT_FALSE( !gp ); } - EXPECT_EQ( gp->key(), i.key() ); + EXPECT_EQ( gp->key(), i.key()); EXPECT_EQ( gp->nFindCount, static_cast( i.key() * 3 )); gp->nFindCount *= 2; @@ -114,7 +114,7 @@ namespace cds_test { EXPECT_TRUE( !gp ); switch ( idx % 3 ) { case 0: - gp = s.extract( i.key() ); + gp = s.extract( i.key()); ASSERT_FALSE( !gp ); break; case 1: @@ -122,28 +122,28 @@ namespace cds_test { ASSERT_FALSE( !gp ); break; case 2: - gp = s.extract_with( other_item( i.key() ), other_less() ); + gp = s.extract_with( other_item( i.key()), other_less()); ASSERT_FALSE( !gp ); break; } - EXPECT_EQ( gp->key(), i.key() ); + EXPECT_EQ( gp->key(), i.key()); EXPECT_EQ( gp->nFindCount, static_cast( i.key() * 6 )); switch ( idx % 3 ) { case 0: - gp = s.extract( i.key() ); + gp = s.extract( i.key()); break; case 1: gp = s.extract( i ); break; case 2: - gp = s.extract_with( other_item( i.key() ), other_less() ); + gp = s.extract_with( other_item( i.key()), other_less()); break; } EXPECT_TRUE( !gp ); } - EXPECT_TRUE( s.empty() ); + EXPECT_TRUE( s.empty()); EXPECT_CONTAINER_SIZE( s, 0 ); } diff --git a/test/unit/stack/fcstack.cpp b/test/unit/stack/fcstack.cpp index b82247ef..5ef55b42 100644 --- a/test/unit/stack/fcstack.cpp +++ b/test/unit/stack/fcstack.cpp @@ -45,46 +45,46 @@ namespace { Stack stack; value_type v; - ASSERT_TRUE( stack.empty() ); + ASSERT_TRUE( stack.empty()); ASSERT_EQ( stack.size(), 0u ); - ASSERT_TRUE( stack.push( 1 ) ); - ASSERT_TRUE( !stack.empty() ); + ASSERT_TRUE( stack.push( 1 )); + ASSERT_TRUE( !stack.empty()); ASSERT_EQ( stack.size(), 1u ); - ASSERT_TRUE( stack.push( 2 ) ); - ASSERT_TRUE( !stack.empty() ); + ASSERT_TRUE( stack.push( 2 )); + ASSERT_TRUE( !stack.empty()); ASSERT_EQ( stack.size(), 2u ); - ASSERT_TRUE( stack.push( 3 ) ); - ASSERT_TRUE( !stack.empty() ); + ASSERT_TRUE( stack.push( 3 )); + ASSERT_TRUE( !stack.empty()); ASSERT_EQ( stack.size(), 3u ); - ASSERT_TRUE( stack.pop( v ) ); + ASSERT_TRUE( stack.pop( v )); EXPECT_EQ( v, value_type( 3 )); - ASSERT_TRUE( !stack.empty() ); + ASSERT_TRUE( !stack.empty()); ASSERT_EQ( stack.size(), 2u ); - ASSERT_TRUE( stack.pop( v ) ); + ASSERT_TRUE( stack.pop( v )); EXPECT_EQ( v, value_type( 2 )); - ASSERT_TRUE( !stack.empty() ); + ASSERT_TRUE( !stack.empty()); ASSERT_EQ( stack.size(), 1u ); - ASSERT_TRUE( stack.pop( v ) ); + ASSERT_TRUE( stack.pop( v )); EXPECT_EQ( v, value_type( 1 )); - ASSERT_TRUE( stack.empty() ); + ASSERT_TRUE( stack.empty()); ASSERT_EQ( stack.size(), 0u ); v = 1000; - ASSERT_TRUE( !stack.pop( v ) ); + ASSERT_TRUE( !stack.pop( v )); EXPECT_EQ( v, value_type( 1000 )); - ASSERT_TRUE( stack.empty() ); + ASSERT_TRUE( stack.empty()); ASSERT_EQ( stack.size(), 0u ); - ASSERT_TRUE( stack.push( 10 ) ); - ASSERT_TRUE( stack.push( 20 ) ); - ASSERT_TRUE( stack.push( 30 ) ); - ASSERT_TRUE( !stack.empty() ); + ASSERT_TRUE( stack.push( 10 )); + ASSERT_TRUE( stack.push( 20 )); + ASSERT_TRUE( stack.push( 30 )); + ASSERT_TRUE( !stack.empty()); ASSERT_EQ( stack.size(), 3u ); - while ( stack.pop( v ) ); + while ( stack.pop( v )); - ASSERT_TRUE( stack.empty() ); + ASSERT_TRUE( stack.empty()); ASSERT_EQ( stack.size(), 0u ); } }; diff --git a/test/unit/stack/intrusive_fcstack.cpp b/test/unit/stack/intrusive_fcstack.cpp index 32b25bbb..7da0144b 100644 --- a/test/unit/stack/intrusive_fcstack.cpp +++ b/test/unit/stack/intrusive_fcstack.cpp @@ -75,35 +75,35 @@ namespace { typedef typename Stack::value_type value_type; Stack stack; - ASSERT_TRUE( stack.empty() ); + ASSERT_TRUE( stack.empty()); value_type v1, v2, v3; v1.nVal = 1; v2.nVal = 2; v3.nVal = 3; - ASSERT_TRUE( stack.push( v1 ) ); - ASSERT_TRUE( !stack.empty() ); - ASSERT_TRUE( stack.push( v2 ) ); - ASSERT_TRUE( !stack.empty() ); - ASSERT_TRUE( stack.push( v3 ) ); - ASSERT_TRUE( !stack.empty() ); + ASSERT_TRUE( stack.push( v1 )); + ASSERT_TRUE( !stack.empty()); + ASSERT_TRUE( stack.push( v2 )); + ASSERT_TRUE( !stack.empty()); + ASSERT_TRUE( stack.push( v3 )); + ASSERT_TRUE( !stack.empty()); value_type * pv; pv = stack.pop(); ASSERT_TRUE( pv != nullptr ); ASSERT_EQ( pv->nVal, 3 ); - ASSERT_TRUE( !stack.empty() ); + ASSERT_TRUE( !stack.empty()); pv = stack.pop(); ASSERT_TRUE( pv != nullptr ); ASSERT_EQ( pv->nVal, 2 ); - ASSERT_TRUE( !stack.empty() ); + ASSERT_TRUE( !stack.empty()); pv = stack.pop(); ASSERT_TRUE( pv != nullptr ); ASSERT_EQ( pv->nVal, 1 ); - ASSERT_TRUE( stack.empty() ); + ASSERT_TRUE( stack.empty()); pv = stack.pop(); ASSERT_TRUE( pv == nullptr ); - ASSERT_TRUE( stack.empty() ); + ASSERT_TRUE( stack.empty()); if ( !std::is_same::value ) { int v1disp = v1.nDisposeCount; @@ -115,19 +115,19 @@ namespace { ASSERT_TRUE( stack.push( v3 )); stack.clear(); - ASSERT_TRUE( stack.empty() ); + ASSERT_TRUE( stack.empty()); EXPECT_EQ( v1.nDisposeCount, v1disp); EXPECT_EQ( v2.nDisposeCount, v2disp); EXPECT_EQ( v3.nDisposeCount, v3disp); - ASSERT_TRUE( stack.push( v1 ) ); - ASSERT_TRUE( stack.push( v2 ) ); - ASSERT_TRUE( stack.push( v3 ) ); - ASSERT_TRUE( !stack.empty() ); + ASSERT_TRUE( stack.push( v1 )); + ASSERT_TRUE( stack.push( v2 )); + ASSERT_TRUE( stack.push( v3 )); + ASSERT_TRUE( !stack.empty()); stack.clear( true ); - ASSERT_TRUE( stack.empty() ); + ASSERT_TRUE( stack.empty()); EXPECT_EQ( v1.nDisposeCount, v1disp + 1 ); EXPECT_EQ( v2.nDisposeCount, v2disp + 1 ); diff --git a/test/unit/stack/test_intrusive_treiber_stack.h b/test/unit/stack/test_intrusive_treiber_stack.h index 92874d4f..3e729fe3 100644 --- a/test/unit/stack/test_intrusive_treiber_stack.h +++ b/test/unit/stack/test_intrusive_treiber_stack.h @@ -76,38 +76,38 @@ namespace cds_test { { typedef typename Stack::value_type value_type; - ASSERT_TRUE( stack.empty() ); + ASSERT_TRUE( stack.empty()); value_type v1, v2, v3; v1.nVal = 1; v2.nVal = 2; v3.nVal = 3; - ASSERT_TRUE( stack.push( v1 ) ); - ASSERT_TRUE( !stack.empty() ); - ASSERT_TRUE( stack.push( v2 ) ); - ASSERT_TRUE( !stack.empty() ); - ASSERT_TRUE( stack.push( v3 ) ); - ASSERT_TRUE( !stack.empty() ); + ASSERT_TRUE( stack.push( v1 )); + ASSERT_TRUE( !stack.empty()); + ASSERT_TRUE( stack.push( v2 )); + ASSERT_TRUE( !stack.empty()); + ASSERT_TRUE( stack.push( v3 )); + ASSERT_TRUE( !stack.empty()); value_type * pv; pv = stack.pop(); ASSERT_NE( pv, nullptr ); ASSERT_EQ( pv, &v3 ); ASSERT_EQ( pv->nVal, 3 ); - ASSERT_TRUE( !stack.empty() ); + ASSERT_TRUE( !stack.empty()); pv = stack.pop(); ASSERT_NE( pv, nullptr ); ASSERT_EQ( pv, &v2 ); ASSERT_EQ( pv->nVal, 2 ); - ASSERT_TRUE( !stack.empty() ); + ASSERT_TRUE( !stack.empty()); pv = stack.pop(); ASSERT_NE( pv, nullptr ); ASSERT_EQ( pv, &v1 ); ASSERT_EQ( pv->nVal, 1 ); - ASSERT_TRUE( stack.empty() ); + ASSERT_TRUE( stack.empty()); pv = stack.pop(); ASSERT_EQ( pv, nullptr ); - ASSERT_TRUE( stack.empty() ); + ASSERT_TRUE( stack.empty()); ASSERT_EQ( v1.nDisposeCount, 0 ); ASSERT_EQ( v2.nDisposeCount, 0 ); @@ -118,7 +118,7 @@ namespace cds_test { stack.push( v3 ); stack.clear(); - ASSERT_TRUE( stack.empty() ); + ASSERT_TRUE( stack.empty()); Stack::gc::scan(); if ( !std::is_same::value ) { diff --git a/test/unit/stack/test_treiber_stack.h b/test/unit/stack/test_treiber_stack.h index d6d058c8..33efedcf 100644 --- a/test/unit/stack/test_treiber_stack.h +++ b/test/unit/stack/test_treiber_stack.h @@ -44,40 +44,40 @@ namespace cds_test { typedef typename Stack::value_type value_type; value_type v; - ASSERT_TRUE( stack.empty() ); + ASSERT_TRUE( stack.empty()); - ASSERT_TRUE( stack.push( 1 ) ); - ASSERT_TRUE( !stack.empty() ); - ASSERT_TRUE( stack.push( 2 ) ); - ASSERT_TRUE( !stack.empty() ); - ASSERT_TRUE( stack.push( 3 ) ); - ASSERT_TRUE( !stack.empty() ); + ASSERT_TRUE( stack.push( 1 )); + ASSERT_TRUE( !stack.empty()); + ASSERT_TRUE( stack.push( 2 )); + ASSERT_TRUE( !stack.empty()); + ASSERT_TRUE( stack.push( 3 )); + ASSERT_TRUE( !stack.empty()); - ASSERT_TRUE( stack.pop( v ) ); + ASSERT_TRUE( stack.pop( v )); ASSERT_EQ( v, 3 ); - ASSERT_TRUE( !stack.empty() ); - ASSERT_TRUE( stack.pop_with( [&v]( value_type& src ) { v = src; } ) ); + ASSERT_TRUE( !stack.empty()); + ASSERT_TRUE( stack.pop_with( [&v]( value_type& src ) { v = src; } )); ASSERT_EQ( v, 2 ); - ASSERT_TRUE( !stack.empty() ); - ASSERT_TRUE( stack.pop( v ) ); + ASSERT_TRUE( !stack.empty()); + ASSERT_TRUE( stack.pop( v )); ASSERT_EQ( v, 1 ); - ASSERT_TRUE( stack.empty() ); + ASSERT_TRUE( stack.empty()); v = 1000; - ASSERT_TRUE( !stack.pop( v ) ); + ASSERT_TRUE( !stack.pop( v )); ASSERT_EQ( v, 1000 ); - ASSERT_TRUE( stack.empty() ); + ASSERT_TRUE( stack.empty()); - ASSERT_TRUE( stack.push( 10 ) ); - ASSERT_TRUE( stack.push( 20 ) ); - ASSERT_TRUE( stack.push( 30 ) ); - ASSERT_TRUE( !stack.empty() ); + ASSERT_TRUE( stack.push( 10 )); + ASSERT_TRUE( stack.push( 20 )); + ASSERT_TRUE( stack.push( 30 )); + ASSERT_TRUE( !stack.empty()); - ASSERT_TRUE( stack.emplace( 100 ) ); - ASSERT_TRUE( stack.pop( v ) ); + ASSERT_TRUE( stack.emplace( 100 )); + ASSERT_TRUE( stack.pop( v )); ASSERT_EQ( v, 100 ); stack.clear(); - ASSERT_TRUE( stack.empty() ); + ASSERT_TRUE( stack.empty()); Stack::gc::scan(); } diff --git a/test/unit/striped-map/cuckoo_map.cpp b/test/unit/striped-map/cuckoo_map.cpp index 021ca9a6..64804903 100644 --- a/test/unit/striped-map/cuckoo_map.cpp +++ b/test/unit/striped-map/cuckoo_map.cpp @@ -148,7 +148,7 @@ namespace { > map_type; typename map_type::hash_tuple_type ht; - map_type m( std::move( ht ) ); + map_type m( std::move( ht )); test( m ); } @@ -164,7 +164,7 @@ namespace { > map_type; typename map_type::hash_tuple_type ht; - map_type m( 32, 6, 0, std::move( ht ) ); + map_type m( 32, 6, 0, std::move( ht )); test( m ); } @@ -180,7 +180,7 @@ namespace { > map_type; typename map_type::hash_tuple_type ht; - map_type m( std::move( ht ) ); + map_type m( std::move( ht )); test( m ); } @@ -373,7 +373,7 @@ namespace { > map_type; typename map_type::hash_tuple_type ht; - map_type m( std::move( ht ) ); + map_type m( std::move( ht )); test( m ); } @@ -390,7 +390,7 @@ namespace { > map_type; typename map_type::hash_tuple_type ht; - map_type m( 32, 6, 0, std::move( ht ) ); + map_type m( 32, 6, 0, std::move( ht )); test( m ); } @@ -407,7 +407,7 @@ namespace { > map_type; typename map_type::hash_tuple_type ht; - map_type m( std::move( ht ) ); + map_type m( std::move( ht )); test( m ); } diff --git a/test/unit/striped-map/test_map.h b/test/unit/striped-map/test_map.h index 08dfcdc9..bb49f437 100644 --- a/test/unit/striped-map/test_map.h +++ b/test/unit/striped-map/test_map.h @@ -276,17 +276,17 @@ namespace cds_test { EXPECT_EQ( std::to_string( v.first.nKey ), v.second.strVal ); } )); } - ASSERT_FALSE( m.empty() ); + ASSERT_FALSE( m.empty()); ASSERT_CONTAINER_SIZE( m, kkSize ); - shuffle( arrKeys.begin(), arrKeys.end() ); + shuffle( arrKeys.begin(), arrKeys.end()); // erase/find for ( auto const& i : arrKeys ) { - value_type const& val( arrVals.at( i.nKey ) ); + value_type const& val( arrVals.at( i.nKey )); ASSERT_TRUE( m.contains( i.nKey )); - ASSERT_TRUE( m.contains( val.strVal ) ); + ASSERT_TRUE( m.contains( val.strVal )); ASSERT_TRUE( m.contains( i )); ASSERT_TRUE( m.contains( other_item( i.nKey ), other_predicate())); ASSERT_TRUE( m.find( i, []( map_pair const& v ) { @@ -372,19 +372,19 @@ namespace cds_test { EXPECT_TRUE( false ); } )); } - ASSERT_TRUE( m.empty() ); + ASSERT_TRUE( m.empty()); ASSERT_CONTAINER_SIZE( m, 0 ); // clear for ( auto const& i : arrKeys ) ASSERT_TRUE( m.insert( i )); - ASSERT_FALSE( m.empty() ); + ASSERT_FALSE( m.empty()); ASSERT_CONTAINER_SIZE( m, kkSize ); m.clear(); - ASSERT_TRUE( m.empty() ); + ASSERT_TRUE( m.empty()); ASSERT_CONTAINER_SIZE( m, 0 ); } }; diff --git a/test/unit/striped-map/test_striped_map.h b/test/unit/striped-map/test_striped_map.h index 4ad0e42b..6463476c 100644 --- a/test/unit/striped-map/test_striped_map.h +++ b/test/unit/striped-map/test_striped_map.h @@ -43,7 +43,7 @@ namespace { { bool operator()( Map& m, int key ) const { - return m.contains( cds_test::striped_map_fixture::other_item( key ), cds_test::striped_map_fixture::other_less() ); + return m.contains( cds_test::striped_map_fixture::other_item( key ), cds_test::striped_map_fixture::other_less()); } }; @@ -81,7 +81,7 @@ namespace { { bool operator()( Map& m, int key ) const { - return m.erase_with( cds_test::striped_map_fixture::other_item( key ), cds_test::striped_map_fixture::other_less() ); + return m.erase_with( cds_test::striped_map_fixture::other_item( key ), cds_test::striped_map_fixture::other_less()); } template @@ -157,7 +157,7 @@ namespace { ASSERT_FALSE( m.contains( i.nKey )); ASSERT_FALSE( m.contains( i )); - ASSERT_FALSE(( call_contains_with()( m, i.nKey ) )); + ASSERT_FALSE(( call_contains_with()( m, i.nKey ))); ASSERT_FALSE( m.find( i, []( map_pair const& ) { ASSERT_TRUE( false ); } )); @@ -334,7 +334,7 @@ namespace { ASSERT_TRUE( m.contains( i.nKey )); ASSERT_TRUE( m.contains( i )); - ASSERT_TRUE(( call_contains_with()( m, i.nKey ) )); + ASSERT_TRUE(( call_contains_with()( m, i.nKey ))); ASSERT_TRUE( m.find( i, []( map_pair const& v ) { EXPECT_EQ( v.first.nKey, v.second.nVal ); EXPECT_EQ( std::to_string( v.first.nKey ), v.second.strVal ); @@ -348,17 +348,17 @@ namespace { EXPECT_EQ( std::to_string( v.first.nKey ), v.second.strVal ); } ))); } - ASSERT_FALSE( m.empty() ); + ASSERT_FALSE( m.empty()); ASSERT_CONTAINER_SIZE( m, kkSize ); - shuffle( arrKeys.begin(), arrKeys.end() ); + shuffle( arrKeys.begin(), arrKeys.end()); // erase/find for ( auto const& i : arrKeys ) { - value_type const& val( arrVals.at( i.nKey ) ); + value_type const& val( arrVals.at( i.nKey )); ASSERT_TRUE( m.contains( i.nKey )); - ASSERT_TRUE( m.contains( val.strVal ) ); + ASSERT_TRUE( m.contains( val.strVal )); ASSERT_TRUE( m.contains( i )); ASSERT_TRUE(( call_contains_with()( m, i.nKey ))); ASSERT_TRUE( m.find( i, []( map_pair const& v ) { @@ -444,19 +444,19 @@ namespace { EXPECT_TRUE( false ); } ))); } - ASSERT_TRUE( m.empty() ); + ASSERT_TRUE( m.empty()); ASSERT_CONTAINER_SIZE( m, 0 ); // clear for ( auto const& i : arrKeys ) ASSERT_TRUE( m.insert( i )); - ASSERT_FALSE( m.empty() ); + ASSERT_FALSE( m.empty()); ASSERT_CONTAINER_SIZE( m, kkSize ); m.clear(); - ASSERT_TRUE( m.empty() ); + ASSERT_TRUE( m.empty()); ASSERT_CONTAINER_SIZE( m, 0 ); } }; @@ -548,7 +548,7 @@ namespace { cds::opt::resizing_policy< cc::striped_set::load_factor_resizing<0>> > map_type; - map_type m( 30, cc::striped_set::load_factor_resizing<0>( 8 ) ); + map_type m( 30, cc::striped_set::load_factor_resizing<0>( 8 )); this->test( m ); } @@ -604,7 +604,7 @@ namespace { cds::opt::copy_policy< cc::striped_set::move_item > > map_type; - map_type m( 30, cc::striped_set::load_factor_resizing<0>( 8 ) ); + map_type m( 30, cc::striped_set::load_factor_resizing<0>( 8 )); this->test( m ); } @@ -721,7 +721,7 @@ namespace { cds::opt::resizing_policy< cc::striped_set::load_factor_resizing<0>> > map_type; - map_type m( 30, cc::striped_set::load_factor_resizing<0>( 8 ) ); + map_type m( 30, cc::striped_set::load_factor_resizing<0>( 8 )); this->test( m ); } @@ -781,7 +781,7 @@ namespace { cds::opt::copy_policy< cc::striped_set::move_item > > map_type; - map_type m( 30, cc::striped_set::load_factor_resizing<0>( 8 ) ); + map_type m( 30, cc::striped_set::load_factor_resizing<0>( 8 )); this->test( m ); } diff --git a/test/unit/striped-set/cuckoo_set.cpp b/test/unit/striped-set/cuckoo_set.cpp index 3ac201eb..a9658a03 100644 --- a/test/unit/striped-set/cuckoo_set.cpp +++ b/test/unit/striped-set/cuckoo_set.cpp @@ -148,7 +148,7 @@ namespace { > set_type; typename set_type::hash_tuple_type ht; - set_type s( std::move( ht ) ); + set_type s( std::move( ht )); test( s ); } @@ -164,7 +164,7 @@ namespace { > set_type; typename set_type::hash_tuple_type ht; - set_type s( 32, 6, 0, std::move( ht ) ); + set_type s( 32, 6, 0, std::move( ht )); test( s ); } @@ -180,7 +180,7 @@ namespace { > set_type; typename set_type::hash_tuple_type ht; - set_type s( std::move( ht ) ); + set_type s( std::move( ht )); test( s ); } @@ -373,7 +373,7 @@ namespace { > set_type; typename set_type::hash_tuple_type ht; - set_type s( std::move( ht ) ); + set_type s( std::move( ht )); test( s ); } @@ -390,7 +390,7 @@ namespace { > set_type; typename set_type::hash_tuple_type ht; - set_type s( 32, 6, 0, std::move( ht ) ); + set_type s( 32, 6, 0, std::move( ht )); test( s ); } @@ -407,7 +407,7 @@ namespace { > set_type; typename set_type::hash_tuple_type ht; - set_type s( std::move( ht ) ); + set_type s( std::move( ht )); test( s ); } diff --git a/test/unit/striped-set/intrusive_boost_unordered_set.cpp b/test/unit/striped-set/intrusive_boost_unordered_set.cpp index 85848904..7e653073 100644 --- a/test/unit/striped-set/intrusive_boost_unordered_set.cpp +++ b/test/unit/striped-set/intrusive_boost_unordered_set.cpp @@ -120,7 +120,7 @@ namespace { std::vector< typename set_type::value_type > data; { - set_type s( 64, ci::striped_set::single_bucket_size_threshold<0>( 128 ) ); + set_type s( 64, ci::striped_set::single_bucket_size_threshold<0>( 128 )); this->test( s, data ); } } @@ -184,7 +184,7 @@ namespace { std::vector< typename set_type::value_type > data; { - set_type s( 64, ci::striped_set::single_bucket_size_threshold<0>( 128 ) ); + set_type s( 64, ci::striped_set::single_bucket_size_threshold<0>( 128 )); this->test( s, data ); } } @@ -248,7 +248,7 @@ namespace { std::vector< typename set_type::value_type > data; { - set_type s( 64, ci::striped_set::single_bucket_size_threshold<0>( 128 ) ); + set_type s( 64, ci::striped_set::single_bucket_size_threshold<0>( 128 )); this->test( s, data ); } } @@ -315,7 +315,7 @@ namespace { std::vector< typename set_type::value_type > data; { - set_type s( 64, ci::striped_set::single_bucket_size_threshold<0>( 128 ) ); + set_type s( 64, ci::striped_set::single_bucket_size_threshold<0>( 128 )); this->test( s, data ); } } diff --git a/test/unit/striped-set/intrusive_cuckoo_set.cpp b/test/unit/striped-set/intrusive_cuckoo_set.cpp index fc9d99db..4122f2e8 100644 --- a/test/unit/striped-set/intrusive_cuckoo_set.cpp +++ b/test/unit/striped-set/intrusive_cuckoo_set.cpp @@ -56,14 +56,14 @@ namespace { // clear for ( auto& i : data ) { i.clear_stat(); - ASSERT_TRUE( s.insert( i ) ); + ASSERT_TRUE( s.insert( i )); } - ASSERT_FALSE( s.empty() ); + ASSERT_FALSE( s.empty()); ASSERT_CONTAINER_SIZE( s, nSetSize ); s.clear(); - ASSERT_TRUE( s.empty() ); + ASSERT_TRUE( s.empty()); ASSERT_CONTAINER_SIZE( s, 0 ); for ( auto& i : data ) { EXPECT_EQ( i.nDisposeCount, 1u ); diff --git a/test/unit/striped-set/test_intrusive_set.h b/test/unit/striped-set/test_intrusive_set.h index 7d1ecd6d..6e105052 100644 --- a/test/unit/striped-set/test_intrusive_set.h +++ b/test/unit/striped-set/test_intrusive_set.h @@ -64,7 +64,7 @@ namespace cds_test { void clear_stat() { - memset( this, 0, sizeof( *this ) ); + memset( this, 0, sizeof( *this )); } }; @@ -148,7 +148,7 @@ namespace cds_test { template size_t operator()( const Item& i ) const { - return (*this)( i.key() ); + return (*this)( i.key()); } }; typedef hash_int hash1; @@ -227,7 +227,7 @@ namespace cds_test { struct cmp { int operator ()(const T& v1, const T& v2 ) const { - if ( v1.key() < v2.key() ) + if ( v1.key() < v2.key()) return -1; return v1.key() > v2.key() ? 1 : 0; } @@ -243,7 +243,7 @@ namespace cds_test { template int operator ()(const Q& v1, const T& v2 ) const { - if ( v1 < v2.key() ) + if ( v1 < v2.key()) return -1; return v1 > v2.key() ? 1 : 0; } @@ -334,7 +334,7 @@ namespace cds_test { // Precondition: set is empty // Postcondition: set is empty - ASSERT_TRUE( s.empty() ); + ASSERT_TRUE( s.empty()); ASSERT_CONTAINER_SIZE( s, 0 ); typedef typename Set::value_type value_type; @@ -348,7 +348,7 @@ namespace cds_test { data.push_back( value_type( static_cast( key ))); indices.push_back( key ); } - shuffle( indices.begin(), indices.end() ); + shuffle( indices.begin(), indices.end()); // insert/find for ( auto idx : indices ) { @@ -385,7 +385,7 @@ namespace cds_test { EXPECT_EQ( i.nUpdateNewCount, 0u ); ASSERT_TRUE( s.insert( i, []( value_type& v ) { ++v.nUpdateNewCount;} )); EXPECT_EQ( i.nUpdateNewCount, 1u ); - ASSERT_FALSE( s.insert( i, []( value_type& v ) { ++v.nUpdateNewCount;} ) ); + ASSERT_FALSE( s.insert( i, []( value_type& v ) { ++v.nUpdateNewCount;} )); EXPECT_EQ( i.nUpdateNewCount, 1u ); i.nUpdateNewCount = 0; break; @@ -400,32 +400,32 @@ namespace cds_test { break; } - ASSERT_TRUE( s.contains( i.nKey ) ); - ASSERT_TRUE( s.contains( i ) ); - ASSERT_TRUE( s.contains( other_item( i.key() ), other_predicate())); + ASSERT_TRUE( s.contains( i.nKey )); + ASSERT_TRUE( s.contains( i )); + ASSERT_TRUE( s.contains( other_item( i.key()), other_predicate())); EXPECT_EQ( i.nFindCount, 0u ); ASSERT_TRUE( s.find( i.nKey, []( value_type& v, int ) { ++v.nFindCount; } )); EXPECT_EQ( i.nFindCount, 1u ); - ASSERT_TRUE( s.find_with( other_item( i.key() ), other_predicate(), []( value_type& v, other_item const& ) { ++v.nFindCount; } )); + ASSERT_TRUE( s.find_with( other_item( i.key()), other_predicate(), []( value_type& v, other_item const& ) { ++v.nFindCount; } )); EXPECT_EQ( i.nFindCount, 2u ); } - ASSERT_FALSE( s.empty() ); + ASSERT_FALSE( s.empty()); ASSERT_CONTAINER_SIZE( s, nSetSize ); std::for_each( data.begin(), data.end(), []( value_type& v ) { v.clear_stat(); }); // erase - shuffle( indices.begin(), indices.end() ); + shuffle( indices.begin(), indices.end()); for ( auto idx : indices ) { auto& i = data[ idx ]; - ASSERT_TRUE( s.contains( i.nKey ) ); - ASSERT_TRUE( s.contains( i ) ); - ASSERT_TRUE( s.contains( other_item( i.key() ), other_predicate() ) ); + ASSERT_TRUE( s.contains( i.nKey )); + ASSERT_TRUE( s.contains( i )); + ASSERT_TRUE( s.contains( other_item( i.key()), other_predicate()) ); EXPECT_EQ( i.nFindCount, 0u ); - ASSERT_TRUE( s.find( i.nKey, []( value_type& v, int ) { ++v.nFindCount; } ) ); + ASSERT_TRUE( s.find( i.nKey, []( value_type& v, int ) { ++v.nFindCount; } )); EXPECT_EQ( i.nFindCount, 1u ); - ASSERT_TRUE( s.find_with( other_item( i.key() ), other_predicate(), []( value_type& v, other_item const& ) { ++v.nFindCount; } ) ); + ASSERT_TRUE( s.find_with( other_item( i.key()), other_predicate(), []( value_type& v, other_item const& ) { ++v.nFindCount; } )); EXPECT_EQ( i.nFindCount, 2u ); value_type v( i ); @@ -433,19 +433,19 @@ namespace cds_test { case 0: ASSERT_FALSE( s.unlink( v )); ASSERT_TRUE( s.unlink( i )); - ASSERT_FALSE( s.unlink( i ) ); + ASSERT_FALSE( s.unlink( i )); break; case 1: ASSERT_TRUE( s.erase( i.key())); - ASSERT_FALSE( s.erase( i.key() ) ); + ASSERT_FALSE( s.erase( i.key()) ); break; case 2: ASSERT_TRUE( s.erase( v )); - ASSERT_FALSE( s.erase( v ) ); + ASSERT_FALSE( s.erase( v )); break; case 3: ASSERT_TRUE( s.erase_with( other_item( i.key()), other_predicate())); - ASSERT_FALSE( s.erase_with( other_item( i.key() ), other_predicate() ) ); + ASSERT_FALSE( s.erase_with( other_item( i.key()), other_predicate()) ); break; case 4: EXPECT_EQ( i.nEraseCount, 0u ); @@ -456,9 +456,9 @@ namespace cds_test { break; case 5: EXPECT_EQ( i.nEraseCount, 0u ); - ASSERT_TRUE( s.erase_with( other_item( i.key() ), other_predicate(), []( value_type& val ) { ++val.nEraseCount; } )); + ASSERT_TRUE( s.erase_with( other_item( i.key()), other_predicate(), []( value_type& val ) { ++val.nEraseCount; } )); EXPECT_EQ( i.nEraseCount, 1u ); - ASSERT_FALSE( s.erase_with( other_item( i.key() ), other_predicate(), []( value_type& val ) { ++val.nEraseCount; } )); + ASSERT_FALSE( s.erase_with( other_item( i.key()), other_predicate(), []( value_type& val ) { ++val.nEraseCount; } )); EXPECT_EQ( i.nEraseCount, 1u ); break; } @@ -469,7 +469,7 @@ namespace cds_test { ASSERT_FALSE( s.find( i.nKey, []( value_type&, int ) {} )); ASSERT_FALSE( s.find_with( other_item( i.key()), other_predicate(), []( value_type&, other_item const& ) {} )); } - ASSERT_TRUE( s.empty() ); + ASSERT_TRUE( s.empty()); ASSERT_CONTAINER_SIZE( s, 0u ); // clear @@ -477,25 +477,25 @@ namespace cds_test { i.clear_stat(); ASSERT_TRUE( s.insert( i )); } - ASSERT_FALSE( s.empty() ); + ASSERT_FALSE( s.empty()); ASSERT_CONTAINER_SIZE( s, nSetSize ); s.clear(); - ASSERT_TRUE( s.empty() ); + ASSERT_TRUE( s.empty()); ASSERT_CONTAINER_SIZE( s, 0u ); // clear_and_dispose for ( auto& i : data ) { i.clear_stat(); - ASSERT_TRUE( s.insert( i ) ); + ASSERT_TRUE( s.insert( i )); } - ASSERT_FALSE( s.empty() ); + ASSERT_FALSE( s.empty()); ASSERT_CONTAINER_SIZE( s, nSetSize ); - s.clear_and_dispose( mock_disposer() ); + s.clear_and_dispose( mock_disposer()); - ASSERT_TRUE( s.empty() ); + ASSERT_TRUE( s.empty()); ASSERT_CONTAINER_SIZE( s, 0 ); for ( auto& i : data ) { EXPECT_EQ( i.nDisposeCount, 1u ); diff --git a/test/unit/striped-set/test_intrusive_striped_set.h b/test/unit/striped-set/test_intrusive_striped_set.h index 4a96e20b..efdb876b 100644 --- a/test/unit/striped-set/test_intrusive_striped_set.h +++ b/test/unit/striped-set/test_intrusive_striped_set.h @@ -138,7 +138,7 @@ namespace { std::vector< typename set_type::value_type > data; { - set_type s( 64, ci::striped_set::single_bucket_size_threshold<0>( 4 ) ); + set_type s( 64, ci::striped_set::single_bucket_size_threshold<0>( 4 )); this->test( s, data ); } } @@ -222,7 +222,7 @@ namespace { std::vector< typename set_type::value_type > data; { - set_type s( 64, ci::striped_set::single_bucket_size_threshold<0>( 4 ) ); + set_type s( 64, ci::striped_set::single_bucket_size_threshold<0>( 4 )); this->test( s, data ); } } @@ -391,7 +391,7 @@ namespace { std::vector< typename set_type::value_type > data; { - set_type s( 64, ci::striped_set::single_bucket_size_threshold<0>( 4 ) ); + set_type s( 64, ci::striped_set::single_bucket_size_threshold<0>( 4 )); this->test( s, data ); } } diff --git a/test/unit/striped-set/test_set.h b/test/unit/striped-set/test_set.h index 4e988883..7f648f1f 100644 --- a/test/unit/striped-set/test_set.h +++ b/test/unit/striped-set/test_set.h @@ -67,7 +67,7 @@ namespace cds_test { void clear_stat() { - memset( this, 0, sizeof( *this ) ); + memset( this, 0, sizeof( *this )); } void copy_stat( stat const& s ) @@ -107,7 +107,7 @@ namespace cds_test { template explicit int_item( Q const& src ) - : nKey( src.key() ) + : nKey( src.key()) , nVal( 0 ) {} @@ -122,17 +122,17 @@ namespace cds_test { : stat( src ) , nKey( src.nKey ) , nVal( src.nVal ) - , strVal( std::move( src.strVal ) ) + , strVal( std::move( src.strVal )) {} int_item( int k, std::string&& s ) : nKey( k ) , nVal( k * 2 ) - , strVal( std::move( s ) ) + , strVal( std::move( s )) {} explicit int_item( other_item const& s ) - : nKey( s.key() ) + : nKey( s.key()) , nVal( s.key() * 2 ) {} @@ -236,7 +236,7 @@ namespace cds_test { struct cmp { int operator ()( int_item const& v1, int_item const& v2 ) const { - if ( v1.key() < v2.key() ) + if ( v1.key() < v2.key()) return -1; return v1.key() > v2.key() ? 1 : 0; } @@ -252,7 +252,7 @@ namespace cds_test { template int operator ()( int v1, T const& v2 ) const { - if ( v1 < v2.key() ) + if ( v1 < v2.key()) return -1; return v1 > v2.key() ? 1 : 0; } @@ -287,7 +287,7 @@ namespace cds_test { // Precondition: set is empty // Postcondition: set is empty - ASSERT_TRUE( s.empty() ); + ASSERT_TRUE( s.empty()); ASSERT_CONTAINER_SIZE( s, 0 ); size_t const nSetSize = kSize; @@ -299,18 +299,18 @@ namespace cds_test { data.reserve( kSize ); indices.reserve( kSize ); for ( size_t key = 0; key < kSize; ++key ) { - data.push_back( value_type( static_cast(key) ) ); + data.push_back( value_type( static_cast(key)) ); indices.push_back( key ); } - shuffle( indices.begin(), indices.end() ); + shuffle( indices.begin(), indices.end()); // insert/find for ( auto idx : indices ) { auto& i = data[idx]; - ASSERT_FALSE( s.contains( i.nKey ) ); - ASSERT_FALSE( s.contains( i ) ); - ASSERT_FALSE( s.contains( other_item( i.key() ), other_predicate())); + ASSERT_FALSE( s.contains( i.nKey )); + ASSERT_FALSE( s.contains( i )); + ASSERT_FALSE( s.contains( other_item( i.key()), other_predicate())); ASSERT_FALSE( s.find( i.nKey, []( value_type&, int ) {} )); ASSERT_FALSE( s.find( i, []( value_type&, value_type const& ) {} )); ASSERT_FALSE( s.find_with( other_item( i.key()), other_predicate(), []( value_type&, other_item const& ) {} )); @@ -332,14 +332,14 @@ namespace cds_test { updResult = s.update( i, []( bool bNew, value_type& val, value_type const& arg) { EXPECT_FALSE( bNew ); - EXPECT_EQ( val.key(), arg.key() ); + EXPECT_EQ( val.key(), arg.key()); }, false ); EXPECT_TRUE( updResult.first ); EXPECT_FALSE( updResult.second ); break; case 1: - ASSERT_TRUE( s.insert( i.key() )); - ASSERT_FALSE( s.insert( i.key() )); + ASSERT_TRUE( s.insert( i.key())); + ASSERT_FALSE( s.insert( i.key())); updResult = s.update( i.key(), []( bool bNew, value_type& val, int arg) { EXPECT_FALSE( bNew ); @@ -370,7 +370,7 @@ namespace cds_test { updResult = s.update( i, []( bool bNew, value_type& v, value_type const& arg ) { EXPECT_TRUE( bNew ); - EXPECT_EQ( v.key(), arg.key() ); + EXPECT_EQ( v.key(), arg.key()); ++v.nUpdateNewCount; }); EXPECT_TRUE( updResult.first ); @@ -379,7 +379,7 @@ namespace cds_test { updResult = s.update( i, []( bool bNew, value_type& v, value_type const& arg ) { EXPECT_FALSE( bNew ); - EXPECT_EQ( v.key(), arg.key() ); + EXPECT_EQ( v.key(), arg.key()); ++v.nUpdateNewCount; }, false ); EXPECT_TRUE( updResult.first ); @@ -412,7 +412,7 @@ namespace cds_test { ASSERT_TRUE( s.find( i, []( value_type const& v, value_type const& arg ) { - EXPECT_EQ( v.key(), arg.key() ); + EXPECT_EQ( v.key(), arg.key()); EXPECT_EQ( v.nUpdateNewCount, 2u ); })); break; @@ -420,7 +420,7 @@ namespace cds_test { ASSERT_TRUE( s.emplace( i.key())); ASSERT_TRUE( s.find( i, []( value_type const& v, value_type const& arg ) { - EXPECT_EQ( v.key(), arg.key() ); + EXPECT_EQ( v.key(), arg.key()); EXPECT_EQ( v.nVal, arg.nVal ); })); break; @@ -430,35 +430,35 @@ namespace cds_test { EXPECT_TRUE( str.empty()); ASSERT_TRUE( s.find( i, []( value_type const& v, value_type const& arg ) { - EXPECT_EQ( v.key(), arg.key() ); + EXPECT_EQ( v.key(), arg.key()); EXPECT_EQ( v.nVal, arg.nVal ); EXPECT_EQ( v.strVal, std::string( "Hello!" )); - } ) ); + } )); break; default: // forgot anything?.. ASSERT_TRUE( false ); } - ASSERT_TRUE( s.contains( i.nKey ) ); - ASSERT_TRUE( s.contains( i ) ); - ASSERT_TRUE( s.contains( other_item( i.key() ), other_predicate() ) ); - ASSERT_TRUE( s.find( i.nKey, []( value_type&, int ) {} ) ); - ASSERT_TRUE( s.find( i, []( value_type&, value_type const& ) {} ) ); - ASSERT_TRUE( s.find_with( other_item( i.key() ), other_predicate(), []( value_type&, other_item const& ) {} ) ); + ASSERT_TRUE( s.contains( i.nKey )); + ASSERT_TRUE( s.contains( i )); + ASSERT_TRUE( s.contains( other_item( i.key()), other_predicate()) ); + ASSERT_TRUE( s.find( i.nKey, []( value_type&, int ) {} )); + ASSERT_TRUE( s.find( i, []( value_type&, value_type const& ) {} )); + ASSERT_TRUE( s.find_with( other_item( i.key()), other_predicate(), []( value_type&, other_item const& ) {} )); } - ASSERT_FALSE( s.empty() ); + ASSERT_FALSE( s.empty()); ASSERT_CONTAINER_SIZE( s, nSetSize ); // erase - shuffle( indices.begin(), indices.end() ); + shuffle( indices.begin(), indices.end()); for ( auto idx : indices ) { auto& i = data[idx]; - ASSERT_TRUE( s.contains( i.nKey ) ); - ASSERT_TRUE( s.contains( i ) ); - ASSERT_TRUE( s.contains( other_item( i.key() ), other_predicate() ) ); + ASSERT_TRUE( s.contains( i.nKey )); + ASSERT_TRUE( s.contains( i )); + ASSERT_TRUE( s.contains( other_item( i.key()), other_predicate()) ); ASSERT_TRUE( s.find( i.nKey, []( value_type& v, int ) { v.nFindCount = 1; @@ -467,7 +467,7 @@ namespace cds_test { { EXPECT_EQ( ++v.nFindCount, 2u ); })); - ASSERT_TRUE( s.find_with( other_item( i.key() ), other_predicate(), []( value_type& v, other_item const& ) + ASSERT_TRUE( s.find_with( other_item( i.key()), other_predicate(), []( value_type& v, other_item const& ) { EXPECT_EQ( ++v.nFindCount, 3u ); })); @@ -484,7 +484,7 @@ namespace cds_test { break; case 2: ASSERT_TRUE( s.erase_with( other_item( i.key()), other_predicate())); - ASSERT_FALSE( s.erase_with( other_item( i.key() ), other_predicate() ) ); + ASSERT_FALSE( s.erase_with( other_item( i.key()), other_predicate()) ); break; case 3: ASSERT_TRUE( s.erase( i.key(), [&nKey]( value_type const& v ) @@ -530,28 +530,28 @@ namespace cds_test { break; } - ASSERT_FALSE( s.contains( i.nKey ) ); - ASSERT_FALSE( s.contains( i ) ); - ASSERT_FALSE( s.contains( other_item( i.key() ), other_predicate())); + ASSERT_FALSE( s.contains( i.nKey )); + ASSERT_FALSE( s.contains( i )); + ASSERT_FALSE( s.contains( other_item( i.key()), other_predicate())); ASSERT_FALSE( s.find( i.nKey, []( value_type&, int ) {} )); ASSERT_FALSE( s.find( i, []( value_type&, value_type const& ) {} )); ASSERT_FALSE( s.find_with( other_item( i.key()), other_predicate(), []( value_type&, other_item const& ) {} )); } - ASSERT_TRUE( s.empty() ); + ASSERT_TRUE( s.empty()); ASSERT_CONTAINER_SIZE( s, 0u ); // clear for ( auto& i : data ) { - ASSERT_TRUE( s.insert( i ) ); + ASSERT_TRUE( s.insert( i )); } - ASSERT_FALSE( s.empty() ); + ASSERT_FALSE( s.empty()); ASSERT_CONTAINER_SIZE( s, nSetSize ); s.clear(); - ASSERT_TRUE( s.empty() ); + ASSERT_TRUE( s.empty()); ASSERT_CONTAINER_SIZE( s, 0u ); } }; diff --git a/test/unit/striped-set/test_striped_set.h b/test/unit/striped-set/test_striped_set.h index 04d151f8..62267155 100644 --- a/test/unit/striped-set/test_striped_set.h +++ b/test/unit/striped-set/test_striped_set.h @@ -133,7 +133,7 @@ namespace { // Precondition: set is empty // Postcondition: set is empty - ASSERT_TRUE( s.empty() ); + ASSERT_TRUE( s.empty()); ASSERT_CONTAINER_SIZE( s, 0 ); size_t const nSetSize = kSize; @@ -144,20 +144,20 @@ namespace { data.reserve( kSize ); indices.reserve( kSize ); for ( size_t key = 0; key < kSize; ++key ) { - data.push_back( value_type( static_cast(key) ) ); + data.push_back( value_type( static_cast(key)) ); indices.push_back( key ); } - shuffle( indices.begin(), indices.end() ); + shuffle( indices.begin(), indices.end()); // insert/find for ( auto idx : indices ) { auto& i = data[idx]; - ASSERT_FALSE( s.contains( i.nKey ) ); + ASSERT_FALSE( s.contains( i.nKey )); ASSERT_FALSE( s.contains( i )); ASSERT_FALSE( (call_contains_with< c_hasFindWith, Set >()( s, i.key()))); - ASSERT_FALSE( s.find( i.nKey, []( value_type&, int ) {} ) ); - ASSERT_FALSE( s.find( i, []( value_type&, value_type const& ) {} ) ); + ASSERT_FALSE( s.find( i.nKey, []( value_type&, int ) {} )); + ASSERT_FALSE( s.find( i, []( value_type&, value_type const& ) {} )); ASSERT_FALSE( (call_find_with< c_hasFindWith, Set >()(s, i.key(), []( value_type&, other_item const& ) {} ))); std::pair updResult; @@ -172,19 +172,19 @@ namespace { switch ( idx % 8 ) { case 0: - ASSERT_TRUE( s.insert( i ) ); - ASSERT_FALSE( s.insert( i ) ); + ASSERT_TRUE( s.insert( i )); + ASSERT_FALSE( s.insert( i )); updResult = s.update( i, []( bool bNew, value_type& val, value_type const& arg ) { EXPECT_FALSE( bNew ); - EXPECT_EQ( val.key(), arg.key() ); + EXPECT_EQ( val.key(), arg.key()); }, false ); EXPECT_TRUE( updResult.first ); EXPECT_FALSE( updResult.second ); break; case 1: - ASSERT_TRUE( s.insert( i.key() ) ); - ASSERT_FALSE( s.insert( i.key() ) ); + ASSERT_TRUE( s.insert( i.key()) ); + ASSERT_FALSE( s.insert( i.key()) ); updResult = s.update( i.key(), []( bool bNew, value_type& val, int arg ) { EXPECT_FALSE( bNew ); @@ -194,28 +194,28 @@ namespace { EXPECT_FALSE( updResult.second ); break; case 2: - ASSERT_TRUE( s.insert( i, []( value_type& v ) { ++v.nFindCount; } ) ); - ASSERT_FALSE( s.insert( i, []( value_type& v ) { ++v.nFindCount; } ) ); + ASSERT_TRUE( s.insert( i, []( value_type& v ) { ++v.nFindCount; } )); + ASSERT_FALSE( s.insert( i, []( value_type& v ) { ++v.nFindCount; } )); ASSERT_TRUE( s.find( i.nKey, []( value_type const& v, int key ) { EXPECT_EQ( v.key(), key ); EXPECT_EQ( v.nFindCount, 1u ); - } ) ); + } )); break; case 3: - ASSERT_TRUE( s.insert( i.key(), []( value_type& v ) { ++v.nFindCount; } ) ); - ASSERT_FALSE( s.insert( i.key(), []( value_type& v ) { ++v.nFindCount; } ) ); + ASSERT_TRUE( s.insert( i.key(), []( value_type& v ) { ++v.nFindCount; } )); + ASSERT_FALSE( s.insert( i.key(), []( value_type& v ) { ++v.nFindCount; } )); ASSERT_TRUE( s.find( i.nKey, []( value_type const& v, int key ) { EXPECT_EQ( v.key(), key ); EXPECT_EQ( v.nFindCount, 1u ); - } ) ); + } )); break; case 4: updResult = s.update( i, []( bool bNew, value_type& v, value_type const& arg ) { EXPECT_TRUE( bNew ); - EXPECT_EQ( v.key(), arg.key() ); + EXPECT_EQ( v.key(), arg.key()); ++v.nUpdateNewCount; } ); EXPECT_TRUE( updResult.first ); @@ -224,7 +224,7 @@ namespace { updResult = s.update( i, []( bool bNew, value_type& v, value_type const& arg ) { EXPECT_FALSE( bNew ); - EXPECT_EQ( v.key(), arg.key() ); + EXPECT_EQ( v.key(), arg.key()); ++v.nUpdateNewCount; }, false ); EXPECT_TRUE( updResult.first ); @@ -234,7 +234,7 @@ namespace { { EXPECT_EQ( v.key(), key ); EXPECT_EQ( v.nUpdateNewCount, 2u ); - } ) ); + } )); break; case 5: updResult = s.update( i.key(), []( bool bNew, value_type& v, int arg ) @@ -257,52 +257,52 @@ namespace { ASSERT_TRUE( s.find( i, []( value_type const& v, value_type const& arg ) { - EXPECT_EQ( v.key(), arg.key() ); + EXPECT_EQ( v.key(), arg.key()); EXPECT_EQ( v.nUpdateNewCount, 2u ); - } ) ); + } )); break; case 6: - ASSERT_TRUE( s.emplace( i.key() ) ); + ASSERT_TRUE( s.emplace( i.key()) ); ASSERT_TRUE( s.find( i, []( value_type const& v, value_type const& arg ) { - EXPECT_EQ( v.key(), arg.key() ); + EXPECT_EQ( v.key(), arg.key()); EXPECT_EQ( v.nVal, arg.nVal ); - } ) ); + } )); break; case 7: str = "Hello!"; - ASSERT_TRUE( s.emplace( i.key(), std::move( str ) ) ); - EXPECT_TRUE( str.empty() ); + ASSERT_TRUE( s.emplace( i.key(), std::move( str )) ); + EXPECT_TRUE( str.empty()); ASSERT_TRUE( s.find( i, []( value_type const& v, value_type const& arg ) { - EXPECT_EQ( v.key(), arg.key() ); + EXPECT_EQ( v.key(), arg.key()); EXPECT_EQ( v.nVal, arg.nVal ); - EXPECT_EQ( v.strVal, std::string( "Hello!" ) ); - } ) ); + EXPECT_EQ( v.strVal, std::string( "Hello!" )); + } )); break; default: // forgot anything?.. ASSERT_TRUE( false ); } - ASSERT_TRUE( s.contains( i.nKey ) ); - ASSERT_TRUE( s.contains( i ) ); - ASSERT_TRUE( (call_contains_with< c_hasFindWith, Set>()( s, i.key() ))); - ASSERT_TRUE( s.find( i.nKey, []( value_type&, int ) {} ) ); - ASSERT_TRUE( s.find( i, []( value_type&, value_type const& ) {} ) ); + ASSERT_TRUE( s.contains( i.nKey )); + ASSERT_TRUE( s.contains( i )); + ASSERT_TRUE( (call_contains_with< c_hasFindWith, Set>()( s, i.key()))); + ASSERT_TRUE( s.find( i.nKey, []( value_type&, int ) {} )); + ASSERT_TRUE( s.find( i, []( value_type&, value_type const& ) {} )); ASSERT_TRUE( (call_find_with< c_hasFindWith, Set >()(s, i.key(), []( value_type&, other_item const& ) {}))); } - ASSERT_FALSE( s.empty() ); + ASSERT_FALSE( s.empty()); ASSERT_CONTAINER_SIZE( s, nSetSize ); // erase - shuffle( indices.begin(), indices.end() ); + shuffle( indices.begin(), indices.end()); for ( auto idx : indices ) { auto& i = data[idx]; - ASSERT_TRUE( s.contains( i.nKey ) ); - ASSERT_TRUE( s.contains( i ) ); + ASSERT_TRUE( s.contains( i.nKey )); + ASSERT_TRUE( s.contains( i )); ASSERT_TRUE( (call_contains_with()(s, i.key()))); ASSERT_TRUE( s.find( i.nKey, []( value_type& v, int ) { @@ -319,12 +319,12 @@ namespace { int nKey = i.key() - 1; switch ( idx % 6 ) { case 0: - ASSERT_TRUE( s.erase( i.key() ) ); - ASSERT_FALSE( s.erase( i.key() ) ); + ASSERT_TRUE( s.erase( i.key()) ); + ASSERT_FALSE( s.erase( i.key()) ); break; case 1: - ASSERT_TRUE( s.erase( i ) ); - ASSERT_FALSE( s.erase( i ) ); + ASSERT_TRUE( s.erase( i )); + ASSERT_FALSE( s.erase( i )); break; case 2: ASSERT_TRUE( (call_erase_with()( s, i.key()))); @@ -341,21 +341,21 @@ namespace { ASSERT_FALSE( s.erase( i.key(), [&nKey]( value_type const& v ) { nKey = v.key(); - } ) ); + } )); EXPECT_EQ( i.key(), nKey + 1 ); break; case 4: ASSERT_TRUE( s.erase( i, [&nKey]( value_type const& v ) { nKey = v.key(); - } ) ); + } )); EXPECT_EQ( i.key(), nKey ); nKey = i.key() - 1; ASSERT_FALSE( s.erase( i, [&nKey]( value_type const& v ) { nKey = v.key(); - } ) ); + } )); EXPECT_EQ( i.key(), nKey + 1 ); break; case 5: @@ -374,28 +374,28 @@ namespace { break; } - ASSERT_FALSE( s.contains( i.nKey ) ); - ASSERT_FALSE( s.contains( i ) ); + ASSERT_FALSE( s.contains( i.nKey )); + ASSERT_FALSE( s.contains( i )); ASSERT_FALSE( (call_contains_with()( s, i.key()))); - ASSERT_FALSE( s.find( i.nKey, []( value_type&, int ) {} ) ); + ASSERT_FALSE( s.find( i.nKey, []( value_type&, int ) {} )); ASSERT_FALSE( s.find( i, []( value_type&, value_type const& ) {} )); ASSERT_FALSE( (call_find_with()( s, i.key(), []( value_type&, other_item const& ) {}))); } - ASSERT_TRUE( s.empty() ); + ASSERT_TRUE( s.empty()); ASSERT_CONTAINER_SIZE( s, 0u ); // clear for ( auto& i : data ) { - ASSERT_TRUE( s.insert( i ) ); + ASSERT_TRUE( s.insert( i )); } - ASSERT_FALSE( s.empty() ); + ASSERT_FALSE( s.empty()); ASSERT_CONTAINER_SIZE( s, nSetSize ); s.clear(); - ASSERT_TRUE( s.empty() ); + ASSERT_TRUE( s.empty()); ASSERT_CONTAINER_SIZE( s, 0u ); } @@ -543,7 +543,7 @@ namespace { cds::opt::copy_policy< cc::striped_set::move_item > > set_type; - set_type s( 30, cc::striped_set::load_factor_resizing<0>( 8 ) ); + set_type s( 30, cc::striped_set::load_factor_resizing<0>( 8 )); this->test( s ); } @@ -660,7 +660,7 @@ namespace { cds::opt::resizing_policy< cc::striped_set::load_factor_resizing<0>> > set_type; - set_type s( 30, cc::striped_set::load_factor_resizing<0>( 8 ) ); + set_type s( 30, cc::striped_set::load_factor_resizing<0>( 8 )); this->test( s ); } @@ -720,7 +720,7 @@ namespace { cds::opt::copy_policy< cc::striped_set::move_item > > set_type; - set_type s( 30, cc::striped_set::load_factor_resizing<0>( 8 ) ); + set_type s( 30, cc::striped_set::load_factor_resizing<0>( 8 )); this->test( s ); } diff --git a/test/unit/tree/test_bronson_avltree_map.h b/test/unit/tree/test_bronson_avltree_map.h index 3403c8c9..151259c8 100644 --- a/test/unit/tree/test_bronson_avltree_map.h +++ b/test/unit/tree/test_bronson_avltree_map.h @@ -269,19 +269,19 @@ namespace { EXPECT_EQ( std::to_string( key.nKey ), val.strVal ); } )); } - ASSERT_FALSE( m.empty() ); + ASSERT_FALSE( m.empty()); ASSERT_CONTAINER_SIZE( m, kkSize ); ASSERT_TRUE( m.check_consistency()); - shuffle( arrKeys.begin(), arrKeys.end() ); + shuffle( arrKeys.begin(), arrKeys.end()); // erase/find for ( auto const& i : arrKeys ) { - value_type const& val( arrVals.at( i.nKey ) ); + value_type const& val( arrVals.at( i.nKey )); ASSERT_TRUE( m.contains( i.nKey )); - ASSERT_TRUE( m.contains( val.strVal ) ); + ASSERT_TRUE( m.contains( val.strVal )); ASSERT_TRUE( m.contains( i )); ASSERT_TRUE( m.contains( other_item( i.nKey ), other_less())); ASSERT_TRUE( m.find( i, []( key_type const& key, value_type& val ) { @@ -367,37 +367,37 @@ namespace { EXPECT_TRUE( false ); } )); } - ASSERT_TRUE( m.empty() ); + ASSERT_TRUE( m.empty()); ASSERT_CONTAINER_SIZE( m, 0 ); // clear for ( auto const& i : arrKeys ) ASSERT_TRUE( m.insert( i )); - ASSERT_FALSE( m.empty() ); + ASSERT_FALSE( m.empty()); ASSERT_CONTAINER_SIZE( m, kkSize ); m.clear(); - ASSERT_TRUE( m.empty() ); + ASSERT_TRUE( m.empty()); ASSERT_CONTAINER_SIZE( m, 0 ); for ( auto const& i : arrKeys ) ASSERT_TRUE( m.insert( i, arrVals[ i.nKey ] )); - ASSERT_FALSE( m.empty() ); + ASSERT_FALSE( m.empty()); ASSERT_CONTAINER_SIZE( m, kkSize ); typedef typename Map::exempt_ptr exempt_ptr; // extract - shuffle( arrKeys.begin(), arrKeys.end() ); + shuffle( arrKeys.begin(), arrKeys.end()); exempt_ptr xp; for ( auto const& i : arrKeys ) { value_type const& val = arrVals.at( i.nKey ); - ASSERT_TRUE( m.contains( i.nKey ) ); + ASSERT_TRUE( m.contains( i.nKey )); switch ( i.nKey % 4 ) { case 0: @@ -410,13 +410,13 @@ namespace { xp = m.extract( val.strVal ); break; case 3: - xp = m.extract_with( other_item( i.nKey ), other_less() ); + xp = m.extract_with( other_item( i.nKey ), other_less()); break; } ASSERT_FALSE( !xp ); EXPECT_EQ( xp->nVal, i.nKey ); - ASSERT_FALSE( m.contains( i.nKey ) ); + ASSERT_FALSE( m.contains( i.nKey )); switch ( i.nKey % 4 ) { case 0: @@ -429,23 +429,23 @@ namespace { xp = m.extract( val.strVal ); break; case 3: - xp = m.extract_with( other_item( i.nKey ), other_less() ); + xp = m.extract_with( other_item( i.nKey ), other_less()); break; } EXPECT_TRUE( !xp ); } - ASSERT_TRUE( m.empty() ); + ASSERT_TRUE( m.empty()); ASSERT_CONTAINER_SIZE( m, 0 ); // extract_min - shuffle( arrKeys.begin(), arrKeys.end() ); + shuffle( arrKeys.begin(), arrKeys.end()); for ( auto const& i : arrKeys ) ASSERT_TRUE( m.insert( i, arrVals[ i.nKey ] )); size_t nCount = 0; int nKey = -1; - while ( !m.empty() ) { + while ( !m.empty()) { switch ( nCount % 3 ) { case 0: xp = m.extract_min(); @@ -471,17 +471,17 @@ namespace { xp = m.extract_min(); ASSERT_TRUE( !xp ); EXPECT_EQ( kkSize, nCount ); - ASSERT_TRUE( m.empty() ); + ASSERT_TRUE( m.empty()); ASSERT_CONTAINER_SIZE( m, 0 ); // extract_max - shuffle( arrKeys.begin(), arrKeys.end() ); + shuffle( arrKeys.begin(), arrKeys.end()); for ( auto const& i : arrKeys ) ASSERT_TRUE( m.insert( i, arrVals[ i.nKey ] )); nKey = kkSize; nCount = 0; - while ( !m.empty() ) { + while ( !m.empty()) { switch ( nCount % 3 ) { case 0: xp = m.extract_max(); @@ -508,7 +508,7 @@ namespace { xp = m.extract_max(); ASSERT_TRUE( !xp ); EXPECT_EQ( kkSize, nCount ); - ASSERT_TRUE( m.empty() ); + ASSERT_TRUE( m.empty()); ASSERT_CONTAINER_SIZE( m, 0 ); } diff --git a/test/unit/tree/test_bronson_avltree_map_ptr.h b/test/unit/tree/test_bronson_avltree_map_ptr.h index 2d3be0a8..ae7f6cef 100644 --- a/test/unit/tree/test_bronson_avltree_map_ptr.h +++ b/test/unit/tree/test_bronson_avltree_map_ptr.h @@ -191,19 +191,19 @@ namespace { EXPECT_EQ( std::to_string( key.nKey ), val.strVal ); } )); } - ASSERT_FALSE( m.empty() ); + ASSERT_FALSE( m.empty()); ASSERT_CONTAINER_SIZE( m, kkSize ); ASSERT_TRUE( m.check_consistency()); - shuffle( arrKeys.begin(), arrKeys.end() ); + shuffle( arrKeys.begin(), arrKeys.end()); // erase/find for ( auto const& i : arrKeys ) { - value_type const& val( arrVals.at( i.nKey ) ); + value_type const& val( arrVals.at( i.nKey )); ASSERT_TRUE( m.contains( i.nKey )); - ASSERT_TRUE( m.contains( val.strVal ) ); + ASSERT_TRUE( m.contains( val.strVal )); ASSERT_TRUE( m.contains( i )); ASSERT_TRUE( m.contains( other_item( i.nKey ), other_less())); ASSERT_TRUE( m.find( i, []( key_type const& key, mapped_type& val ) { @@ -289,7 +289,7 @@ namespace { EXPECT_TRUE( false ); } )); } - ASSERT_TRUE( m.empty() ); + ASSERT_TRUE( m.empty()); ASSERT_CONTAINER_SIZE( m, 0 ); Map::gc::force_dispose(); @@ -299,16 +299,16 @@ namespace { // clear for ( auto const& i : arrKeys ) { - value_type& val( arrVals.at( i.nKey ) ); + value_type& val( arrVals.at( i.nKey )); ASSERT_TRUE( m.insert( i, &val )); } - ASSERT_FALSE( m.empty() ); + ASSERT_FALSE( m.empty()); ASSERT_CONTAINER_SIZE( m, kkSize ); m.clear(); - ASSERT_TRUE( m.empty() ); + ASSERT_TRUE( m.empty()); ASSERT_CONTAINER_SIZE( m, 0 ); Map::gc::force_dispose(); @@ -316,7 +316,7 @@ namespace { EXPECT_EQ( item.nDisposeCount, 2u ); } - ASSERT_TRUE( m.check_consistency() ); + ASSERT_TRUE( m.check_consistency()); // RCU-specific test related to exempt_ptr @@ -325,16 +325,16 @@ namespace { // extract for ( auto const& i : arrKeys ) { - value_type& val( arrVals.at( i.nKey ) ); - ASSERT_TRUE( m.insert( i, &val ) ); + value_type& val( arrVals.at( i.nKey )); + ASSERT_TRUE( m.insert( i, &val )); } - ASSERT_FALSE( m.empty() ); + ASSERT_FALSE( m.empty()); ASSERT_CONTAINER_SIZE( m, kkSize ); for ( auto const& i : arrKeys ) { value_type const& val = arrVals.at( i.nKey ); - EXPECT_TRUE( m.contains( i.nKey ) ); + EXPECT_TRUE( m.contains( i.nKey )); switch ( i.nKey % 4 ) { case 0: @@ -347,15 +347,15 @@ namespace { xp = m.extract( val.strVal ); break; case 3: - xp = m.extract_with( other_item( i.nKey ), other_less() ); + xp = m.extract_with( other_item( i.nKey ), other_less()); break; } ASSERT_FALSE( !xp ); EXPECT_EQ( xp->nVal, i.nKey ); - EXPECT_FALSE( m.contains( i.nKey ) ); + EXPECT_FALSE( m.contains( i.nKey )); } - ASSERT_TRUE( m.empty() ); + ASSERT_TRUE( m.empty()); ASSERT_CONTAINER_SIZE( m, 0 ); xp.release(); @@ -365,18 +365,18 @@ namespace { } // extract_min - shuffle( arrKeys.begin(), arrKeys.end() ); + shuffle( arrKeys.begin(), arrKeys.end()); for ( auto const& i : arrKeys ) { - value_type& val( arrVals.at( i.nKey ) ); - ASSERT_TRUE( m.insert( i, &val ) ); + value_type& val( arrVals.at( i.nKey )); + ASSERT_TRUE( m.insert( i, &val )); } - ASSERT_FALSE( m.empty() ); + ASSERT_FALSE( m.empty()); ASSERT_CONTAINER_SIZE( m, kkSize ); - ASSERT_TRUE( m.check_consistency() ); + ASSERT_TRUE( m.check_consistency()); int nPrevKey = -1; size_t nCount = 0; - while ( !m.empty() ) { + while ( !m.empty()) { switch ( nCount % 3 ) { case 0: xp = m.extract_min(); @@ -400,7 +400,7 @@ namespace { nPrevKey = xp->nVal; ++nCount; } - ASSERT_TRUE( m.empty() ); + ASSERT_TRUE( m.empty()); ASSERT_CONTAINER_SIZE( m, 0 ); EXPECT_EQ( nCount, kkSize ); xp.release(); @@ -411,18 +411,18 @@ namespace { } // extract_max - shuffle( arrKeys.begin(), arrKeys.end() ); + shuffle( arrKeys.begin(), arrKeys.end()); for ( auto const& i : arrKeys ) { - value_type& val( arrVals.at( i.nKey ) ); - ASSERT_TRUE( m.insert( i, &val ) ); + value_type& val( arrVals.at( i.nKey )); + ASSERT_TRUE( m.insert( i, &val )); } - ASSERT_FALSE( m.empty() ); + ASSERT_FALSE( m.empty()); ASSERT_CONTAINER_SIZE( m, kkSize ); - ASSERT_TRUE( m.check_consistency() ); + ASSERT_TRUE( m.check_consistency()); nPrevKey = static_cast(kkSize); nCount = 0; - while ( !m.empty() ) { + while ( !m.empty()) { switch ( nCount % 3 ) { case 0: xp = m.extract_max(); @@ -446,7 +446,7 @@ namespace { nPrevKey = xp->nVal; ++nCount; } - ASSERT_TRUE( m.empty() ); + ASSERT_TRUE( m.empty()); ASSERT_CONTAINER_SIZE( m, 0 ); EXPECT_EQ( nCount, kkSize ); xp.release(); @@ -477,7 +477,7 @@ namespace { } // checking empty map - ASSERT_TRUE( m.check_consistency() ); + ASSERT_TRUE( m.check_consistency()); } }; diff --git a/test/unit/tree/test_intrusive_tree.h b/test/unit/tree/test_intrusive_tree.h index d2d10394..111fe78d 100644 --- a/test/unit/tree/test_intrusive_tree.h +++ b/test/unit/tree/test_intrusive_tree.h @@ -62,7 +62,7 @@ namespace cds_test { void clear_stat() { - memset( this, 0, sizeof( *this ) ); + memset( this, 0, sizeof( *this )); } }; @@ -205,7 +205,7 @@ namespace cds_test { { int operator ()(T const& v1, T const& v2 ) const { - if ( v1.key() < v2.key() ) + if ( v1.key() < v2.key()) return -1; return v1.key() > v2.key() ? 1 : 0; } @@ -219,7 +219,7 @@ namespace cds_test { int operator()( int lhs, T const& rhs ) const { - if ( lhs < rhs.key() ) + if ( lhs < rhs.key()) return -1; return lhs > rhs.key() ? 1 : 0; } @@ -281,7 +281,7 @@ namespace cds_test { // Precondition: tree is empty // Postcondition: tree is empty - ASSERT_TRUE( t.empty() ); + ASSERT_TRUE( t.empty()); ASSERT_CONTAINER_SIZE( t, 0 ); size_t const nTreeSize = kSize; @@ -295,7 +295,7 @@ namespace cds_test { data.push_back( value_type( static_cast( key ))); indices.push_back( key ); } - shuffle( indices.begin(), indices.end() ); + shuffle( indices.begin(), indices.end()); // insert/find for ( auto idx : indices ) { @@ -332,7 +332,7 @@ namespace cds_test { EXPECT_EQ( i.nUpdateNewCount, 0u ); ASSERT_TRUE( t.insert( i, []( value_type& v ) { ++v.nUpdateNewCount;} )); EXPECT_EQ( i.nUpdateNewCount, 1u ); - ASSERT_FALSE( t.insert( i, []( value_type& v ) { ++v.nUpdateNewCount;} ) ); + ASSERT_FALSE( t.insert( i, []( value_type& v ) { ++v.nUpdateNewCount;} )); EXPECT_EQ( i.nUpdateNewCount, 1u ); i.nUpdateNewCount = 0; break; @@ -371,34 +371,34 @@ namespace cds_test { break; } - ASSERT_TRUE( t.contains( i.nKey ) ); - ASSERT_TRUE( t.contains( i ) ); - ASSERT_TRUE( t.contains( other_item( i.key() ), other_less())); + ASSERT_TRUE( t.contains( i.nKey )); + ASSERT_TRUE( t.contains( i )); + ASSERT_TRUE( t.contains( other_item( i.key()), other_less())); EXPECT_EQ( i.nFindCount, 0u ); ASSERT_TRUE( t.find( i.nKey, []( value_type& v, int ) { ++v.nFindCount; } )); EXPECT_EQ( i.nFindCount, 1u ); - ASSERT_TRUE( t.find_with( other_item( i.key() ), other_less(), []( value_type& v, other_item const& ) { ++v.nFindCount; } )); + ASSERT_TRUE( t.find_with( other_item( i.key()), other_less(), []( value_type& v, other_item const& ) { ++v.nFindCount; } )); EXPECT_EQ( i.nFindCount, 2u ); - ASSERT_TRUE( t.find( i, []( value_type& v, value_type& ) { ++v.nFindCount; } ) ); + ASSERT_TRUE( t.find( i, []( value_type& v, value_type& ) { ++v.nFindCount; } )); EXPECT_EQ( i.nFindCount, 3u ); } - ASSERT_FALSE( t.empty() ); + ASSERT_FALSE( t.empty()); ASSERT_CONTAINER_SIZE( t, nTreeSize ); std::for_each( data.begin(), data.end(), []( value_type& v ) { v.clear_stat(); }); // erase - shuffle( indices.begin(), indices.end() ); + shuffle( indices.begin(), indices.end()); for ( auto idx : indices ) { auto& i = data[ idx ]; - ASSERT_TRUE( t.contains( i.nKey ) ); - ASSERT_TRUE( t.contains( i ) ); - ASSERT_TRUE( t.contains( other_item( i.key() ), other_less() ) ); + ASSERT_TRUE( t.contains( i.nKey )); + ASSERT_TRUE( t.contains( i )); + ASSERT_TRUE( t.contains( other_item( i.key()), other_less()) ); EXPECT_EQ( i.nFindCount, 0u ); - ASSERT_TRUE( t.find( i.nKey, []( value_type& v, int ) { ++v.nFindCount; } ) ); + ASSERT_TRUE( t.find( i.nKey, []( value_type& v, int ) { ++v.nFindCount; } )); EXPECT_EQ( i.nFindCount, 1u ); - ASSERT_TRUE( t.find_with( other_item( i.key() ), other_less(), []( value_type& v, other_item const& ) { ++v.nFindCount; } ) ); + ASSERT_TRUE( t.find_with( other_item( i.key()), other_less(), []( value_type& v, other_item const& ) { ++v.nFindCount; } )); EXPECT_EQ( i.nFindCount, 2u ); value_type v( i ); @@ -406,19 +406,19 @@ namespace cds_test { case 0: ASSERT_FALSE( t.unlink( v )); ASSERT_TRUE( t.unlink( i )); - ASSERT_FALSE( t.unlink( i ) ); + ASSERT_FALSE( t.unlink( i )); break; case 1: ASSERT_TRUE( t.erase( i.key())); - ASSERT_FALSE( t.erase( i.key() ) ); + ASSERT_FALSE( t.erase( i.key()) ); break; case 2: ASSERT_TRUE( t.erase( v )); - ASSERT_FALSE( t.erase( v ) ); + ASSERT_FALSE( t.erase( v )); break; case 3: ASSERT_TRUE( t.erase_with( other_item( i.key()), other_less())); - ASSERT_FALSE( t.erase_with( other_item( i.key() ), other_less() ) ); + ASSERT_FALSE( t.erase_with( other_item( i.key()), other_less()) ); break; case 4: EXPECT_EQ( i.nEraseCount, 0u ); @@ -429,9 +429,9 @@ namespace cds_test { break; case 5: EXPECT_EQ( i.nEraseCount, 0u ); - ASSERT_TRUE( t.erase_with( other_item( i.key() ), other_less(), []( value_type& val ) { ++val.nEraseCount; } )); + ASSERT_TRUE( t.erase_with( other_item( i.key()), other_less(), []( value_type& val ) { ++val.nEraseCount; } )); EXPECT_EQ( i.nEraseCount, 1u ); - ASSERT_FALSE( t.erase_with( other_item( i.key() ), other_less(), []( value_type& val ) { ++val.nEraseCount; } )); + ASSERT_FALSE( t.erase_with( other_item( i.key()), other_less(), []( value_type& val ) { ++val.nEraseCount; } )); EXPECT_EQ( i.nEraseCount, 1u ); break; } @@ -443,7 +443,7 @@ namespace cds_test { ASSERT_FALSE( t.find( i, []( value_type&, value_type const& ) {} )); ASSERT_FALSE( t.find_with( other_item( i.key()), other_less(), []( value_type&, other_item const& ) {} )); } - ASSERT_TRUE( t.empty() ); + ASSERT_TRUE( t.empty()); ASSERT_CONTAINER_SIZE( t, 0 ); // Force retiring cycle @@ -458,7 +458,7 @@ namespace cds_test { i.clear_stat(); ASSERT_TRUE( t.insert( i )); } - ASSERT_FALSE( t.empty() ); + ASSERT_FALSE( t.empty()); ASSERT_CONTAINER_SIZE( t, nTreeSize ); // clear test diff --git a/test/unit/tree/test_intrusive_tree_hp.h b/test/unit/tree/test_intrusive_tree_hp.h index 07a1762e..926ed35d 100644 --- a/test/unit/tree/test_intrusive_tree_hp.h +++ b/test/unit/tree/test_intrusive_tree_hp.h @@ -54,7 +54,7 @@ namespace cds_test { base_class::test( t ); - ASSERT_TRUE( t.empty() ); + ASSERT_TRUE( t.empty()); ASSERT_CONTAINER_SIZE( t, 0 ); typedef typename Tree::value_type value_type; @@ -64,10 +64,10 @@ namespace cds_test { data.reserve( kSize ); indices.reserve( kSize ); for ( size_t key = 0; key < kSize; ++key ) { - data.push_back( value_type( static_cast(key) ) ); + data.push_back( value_type( static_cast(key)) ); indices.push_back( key ); } - shuffle( indices.begin(), indices.end() ); + shuffle( indices.begin(), indices.end()); typename Tree::guarded_ptr gp; @@ -77,7 +77,7 @@ namespace cds_test { gp = t.get( i ); ASSERT_TRUE( !gp ); - gp = t.get( i.key() ); + gp = t.get( i.key()); ASSERT_TRUE( !gp ); gp = t.get_with( other_item( i.key()), other_less()); ASSERT_TRUE( !gp ); @@ -99,7 +99,7 @@ namespace cds_test { for ( auto idx : indices ) { auto& i = data[idx]; i.nDisposeCount = 0; - ASSERT_TRUE( t.insert( i ) ); + ASSERT_TRUE( t.insert( i )); } // get/extract @@ -112,7 +112,7 @@ namespace cds_test { ++gp->nFindCount; EXPECT_EQ( i.nFindCount, 1u ); - gp = t.get( i.key() ); + gp = t.get( i.key()); ASSERT_FALSE( !gp ); ++gp->nFindCount; EXPECT_EQ( i.nFindCount, 2u ); @@ -131,7 +131,7 @@ namespace cds_test { gp = t.extract( i ); break; case 2: - gp = t.extract_with( other_item( i.key() ), other_less() ); + gp = t.extract_with( other_item( i.key()), other_less()); break; } ASSERT_FALSE( !gp ); @@ -140,15 +140,15 @@ namespace cds_test { gp = t.extract( i ); ASSERT_TRUE( !gp ); - gp = t.extract( i.key() ); + gp = t.extract( i.key()); ASSERT_TRUE( !gp ); - gp = t.extract_with( other_item( i.key() ), other_less() ); + gp = t.extract_with( other_item( i.key()), other_less()); ASSERT_TRUE( !gp ); } gp.release(); - ASSERT_TRUE( t.empty() ); + ASSERT_TRUE( t.empty()); ASSERT_CONTAINER_SIZE( t, 0u ); // Force retiring cycle @@ -161,12 +161,12 @@ namespace cds_test { for ( auto idx : indices ) { auto& i = data[idx]; i.nDisposeCount = 0; - ASSERT_TRUE( t.insert( i ) ); + ASSERT_TRUE( t.insert( i )); } size_t nCount = 0; int nKey = -1; - while ( !t.empty() ) { + while ( !t.empty()) { gp = t.extract_min(); ASSERT_FALSE( !gp ); EXPECT_EQ( gp->key(), nKey + 1 ); @@ -174,9 +174,9 @@ namespace cds_test { nKey = gp->key(); } gp.release(); - ASSERT_TRUE( t.empty() ); + ASSERT_TRUE( t.empty()); ASSERT_CONTAINER_SIZE( t, 0u ); - EXPECT_EQ( nCount, data.size() ); + EXPECT_EQ( nCount, data.size()); // Force retiring cycle Tree::gc::force_dispose(); @@ -188,12 +188,12 @@ namespace cds_test { for ( auto idx : indices ) { auto& i = data[idx]; i.nDisposeCount = 0; - ASSERT_TRUE( t.insert( i ) ); + ASSERT_TRUE( t.insert( i )); } nCount = 0; nKey = static_cast( data.size()); - while ( !t.empty() ) { + while ( !t.empty()) { gp = t.extract_max(); ASSERT_FALSE( !gp ); EXPECT_EQ( gp->key(), nKey - 1 ); @@ -201,9 +201,9 @@ namespace cds_test { nKey = gp->key(); } gp.release(); - ASSERT_TRUE( t.empty() ); + ASSERT_TRUE( t.empty()); ASSERT_CONTAINER_SIZE( t, 0u ); - EXPECT_EQ( nCount, data.size() ); + EXPECT_EQ( nCount, data.size()); // Force retiring cycle Tree::gc::force_dispose(); diff --git a/test/unit/tree/test_intrusive_tree_rcu.h b/test/unit/tree/test_intrusive_tree_rcu.h index 8f1eb99c..a430a713 100644 --- a/test/unit/tree/test_intrusive_tree_rcu.h +++ b/test/unit/tree/test_intrusive_tree_rcu.h @@ -56,7 +56,7 @@ namespace cds_test { base_class::test( t ); - ASSERT_TRUE( t.empty() ); + ASSERT_TRUE( t.empty()); ASSERT_CONTAINER_SIZE( t, 0 ); typedef typename Tree::value_type value_type; @@ -67,10 +67,10 @@ namespace cds_test { data.reserve( kSize ); indices.reserve( kSize ); for ( size_t key = 0; key < kSize; ++key ) { - data.push_back( value_type( static_cast(key) ) ); + data.push_back( value_type( static_cast(key)) ); indices.push_back( key ); } - shuffle( indices.begin(), indices.end() ); + shuffle( indices.begin(), indices.end()); typename Tree::exempt_ptr xp; @@ -82,9 +82,9 @@ namespace cds_test { rcu_lock l; value_type * p = t.get( i ); ASSERT_TRUE( p == nullptr ); - p = t.get( i.key() ); + p = t.get( i.key()); ASSERT_TRUE( !p ); - p = t.get_with( other_item( i.key() ), other_less() ); + p = t.get_with( other_item( i.key()), other_less()); ASSERT_TRUE( p == nullptr ); } @@ -105,7 +105,7 @@ namespace cds_test { for ( auto idx : indices ) { auto& i = data[idx]; i.nDisposeCount = 0; - ASSERT_TRUE( t.insert( i ) ); + ASSERT_TRUE( t.insert( i )); } // get/extract @@ -122,12 +122,12 @@ namespace cds_test { ++p->nFindCount; EXPECT_EQ( i.nFindCount, 1u ); - p = t.get( i.key() ); + p = t.get( i.key()); ASSERT_FALSE( !p ); ++p->nFindCount; EXPECT_EQ( i.nFindCount, 2u ); - p = t.get_with( other_item( i.key() ), other_less() ); + p = t.get_with( other_item( i.key()), other_less()); ASSERT_FALSE( !p ); ++p->nFindCount; EXPECT_EQ( i.nFindCount, 3u ); @@ -142,7 +142,7 @@ namespace cds_test { xp = t.extract( i ); break; case 2: - xp = t.extract_with( other_item( i.key() ), other_less() ); + xp = t.extract_with( other_item( i.key()), other_less()); break; } ASSERT_FALSE( !xp ); @@ -151,13 +151,13 @@ namespace cds_test { xp = t.extract( i ); ASSERT_TRUE( !xp ); - xp = t.extract( i.key() ); + xp = t.extract( i.key()); ASSERT_TRUE( !xp ); - xp = t.extract_with( other_item( i.key() ), other_less() ); + xp = t.extract_with( other_item( i.key()), other_less()); ASSERT_TRUE( !xp ); } - ASSERT_TRUE( t.empty() ); + ASSERT_TRUE( t.empty()); ASSERT_CONTAINER_SIZE( t, 0u ); // Force retiring cycle @@ -170,12 +170,12 @@ namespace cds_test { for ( auto idx : indices ) { auto& i = data[idx]; i.nDisposeCount = 0; - ASSERT_TRUE( t.insert( i ) ); + ASSERT_TRUE( t.insert( i )); } size_t nCount = 0; int nKey = -1; - while ( !t.empty() ) { + while ( !t.empty()) { xp = t.extract_min(); ASSERT_FALSE( !xp ); EXPECT_EQ( xp->key(), nKey + 1 ); @@ -183,9 +183,9 @@ namespace cds_test { nKey = xp->key(); } xp.release(); - ASSERT_TRUE( t.empty() ); + ASSERT_TRUE( t.empty()); ASSERT_CONTAINER_SIZE( t, 0u ); - EXPECT_EQ( nCount, data.size() ); + EXPECT_EQ( nCount, data.size()); // Force retiring cycle Tree::gc::force_dispose(); @@ -197,12 +197,12 @@ namespace cds_test { for ( auto idx : indices ) { auto& i = data[idx]; i.nDisposeCount = 0; - ASSERT_TRUE( t.insert( i ) ); + ASSERT_TRUE( t.insert( i )); } nCount = 0; nKey = static_cast( data.size()); - while ( !t.empty() ) { + while ( !t.empty()) { xp = t.extract_max(); ASSERT_FALSE( !xp ); EXPECT_EQ( xp->key(), nKey - 1 ); @@ -210,9 +210,9 @@ namespace cds_test { nKey = xp->key(); } xp.release(); - ASSERT_TRUE( t.empty() ); + ASSERT_TRUE( t.empty()); ASSERT_CONTAINER_SIZE( t, 0u ); - EXPECT_EQ( nCount, data.size() ); + EXPECT_EQ( nCount, data.size()); // Force retiring cycle Tree::gc::force_dispose(); diff --git a/test/unit/tree/test_tree_map.h b/test/unit/tree/test_tree_map.h index a6e98156..5e086bb2 100644 --- a/test/unit/tree/test_tree_map.h +++ b/test/unit/tree/test_tree_map.h @@ -268,19 +268,19 @@ namespace cds_test { EXPECT_EQ( std::to_string( v.first.nKey ), v.second.strVal ); } )); } - ASSERT_FALSE( m.empty() ); + ASSERT_FALSE( m.empty()); ASSERT_CONTAINER_SIZE( m, kkSize ); ASSERT_TRUE( m.check_consistency()); - shuffle( arrKeys.begin(), arrKeys.end() ); + shuffle( arrKeys.begin(), arrKeys.end()); // erase/find for ( auto const& i : arrKeys ) { - value_type const& val( arrVals.at( i.nKey ) ); + value_type const& val( arrVals.at( i.nKey )); ASSERT_TRUE( m.contains( i.nKey )); - ASSERT_TRUE( m.contains( val.strVal ) ); + ASSERT_TRUE( m.contains( val.strVal )); ASSERT_TRUE( m.contains( i )); ASSERT_TRUE( m.contains( other_item( i.nKey ), other_less())); ASSERT_TRUE( m.find( i, []( map_pair const& v ) { @@ -366,19 +366,19 @@ namespace cds_test { EXPECT_TRUE( false ); } )); } - ASSERT_TRUE( m.empty() ); + ASSERT_TRUE( m.empty()); ASSERT_CONTAINER_SIZE( m, 0 ); // clear for ( auto const& i : arrKeys ) ASSERT_TRUE( m.insert( i )); - ASSERT_FALSE( m.empty() ); + ASSERT_FALSE( m.empty()); ASSERT_CONTAINER_SIZE( m, kkSize ); m.clear(); - ASSERT_TRUE( m.empty() ); + ASSERT_TRUE( m.empty()); ASSERT_CONTAINER_SIZE( m, 0 ); } }; diff --git a/test/unit/tree/test_tree_map_hp.h b/test/unit/tree/test_tree_map_hp.h index 33a9cd98..d4973fb8 100644 --- a/test/unit/tree/test_tree_map_hp.h +++ b/test/unit/tree/test_tree_map_hp.h @@ -67,8 +67,8 @@ namespace cds_test { } for ( auto const& i : arrKeys ) - ASSERT_TRUE( m.insert( i ) ); - ASSERT_FALSE( m.empty() ); + ASSERT_TRUE( m.insert( i )); + ASSERT_FALSE( m.empty()); ASSERT_CONTAINER_SIZE( m, kkSize ); // get/extract @@ -115,7 +115,7 @@ namespace cds_test { gp = m.get_with( other_item( i.nKey ), other_less()); ASSERT_TRUE( !gp ); } - ASSERT_TRUE( m.empty() ); + ASSERT_TRUE( m.empty()); ASSERT_CONTAINER_SIZE( m, 0 ); gp = m.extract_min(); @@ -124,40 +124,40 @@ namespace cds_test { EXPECT_TRUE( !gp ); for ( auto const& i : arrKeys ) - ASSERT_TRUE( m.insert( i ) ); - ASSERT_FALSE( m.empty() ); + ASSERT_TRUE( m.insert( i )); + ASSERT_FALSE( m.empty()); ASSERT_CONTAINER_SIZE( m, kkSize ); // extract_min int nKey = -1; size_t nCount = 0; - while ( !m.empty() ) { + while ( !m.empty()) { gp = m.extract_min(); ASSERT_FALSE( !gp ); EXPECT_EQ( gp->first.nKey, nKey + 1 ); nKey = gp->first.nKey; ++nCount; } - ASSERT_TRUE( m.empty() ); + ASSERT_TRUE( m.empty()); ASSERT_CONTAINER_SIZE( m, 0 ); EXPECT_EQ( nCount, kkSize ); // extract_max for ( auto const& i : arrKeys ) - ASSERT_TRUE( m.insert( i ) ); - ASSERT_FALSE( m.empty() ); + ASSERT_TRUE( m.insert( i )); + ASSERT_FALSE( m.empty()); ASSERT_CONTAINER_SIZE( m, kkSize ); nKey = kkSize; nCount = 0; - while ( !m.empty() ) { + while ( !m.empty()) { gp = m.extract_max(); ASSERT_FALSE( !gp ); EXPECT_EQ( gp->first.nKey, nKey - 1 ); nKey = gp->first.nKey; ++nCount; } - ASSERT_TRUE( m.empty() ); + ASSERT_TRUE( m.empty()); ASSERT_CONTAINER_SIZE( m, 0 ); EXPECT_EQ( nCount, kkSize ); diff --git a/test/unit/tree/test_tree_map_rcu.h b/test/unit/tree/test_tree_map_rcu.h index b358b8d4..fa614fed 100644 --- a/test/unit/tree/test_tree_map_rcu.h +++ b/test/unit/tree/test_tree_map_rcu.h @@ -67,8 +67,8 @@ namespace cds_test { } for ( auto const& i : arrKeys ) - ASSERT_TRUE( m.insert( i ) ); - ASSERT_FALSE( m.empty() ); + ASSERT_TRUE( m.insert( i )); + ASSERT_FALSE( m.empty()); ASSERT_CONTAINER_SIZE( m, kkSize ); typedef typename Map::exempt_ptr exempt_ptr; @@ -76,7 +76,7 @@ namespace cds_test { typedef typename Map::rcu_lock rcu_lock; // get/extract - shuffle( arrKeys.begin(), arrKeys.end() ); + shuffle( arrKeys.begin(), arrKeys.end()); exempt_ptr xp; for ( auto const& i : arrKeys ) { @@ -119,7 +119,7 @@ namespace cds_test { xp = m.extract( val.strVal ); break; case 3: - xp = m.extract_with( other_item( i.nKey ), other_less() ); + xp = m.extract_with( other_item( i.nKey ), other_less()); break; } ASSERT_FALSE( !xp ); @@ -142,7 +142,7 @@ namespace cds_test { xp = m.extract( val.strVal ); break; case 3: - xp = m.extract_with( other_item( i.nKey ), other_less() ); + xp = m.extract_with( other_item( i.nKey ), other_less()); break; } EXPECT_TRUE( !xp ); @@ -178,7 +178,7 @@ namespace cds_test { xp = m.extract( val.strVal ); break; case 3: - xp = m.extract_with( other_item( i.nKey ), other_less() ); + xp = m.extract_with( other_item( i.nKey ), other_less()); break; } EXPECT_TRUE( !xp ); @@ -192,22 +192,22 @@ namespace cds_test { ASSERT_TRUE( !rp ); rp = m.get( i ); ASSERT_TRUE( !rp ); - rp = m.get_with( other_item( i.nKey ), other_less() ); + rp = m.get_with( other_item( i.nKey ), other_less()); ASSERT_TRUE( !rp ); } } - ASSERT_TRUE( m.empty() ); + ASSERT_TRUE( m.empty()); ASSERT_CONTAINER_SIZE( m, 0 ); // extract_min for ( auto const& i : arrKeys ) - ASSERT_TRUE( m.insert( i ) ); + ASSERT_TRUE( m.insert( i )); size_t nCount = 0; int nKey = -1; - while ( !m.empty() ) { + while ( !m.empty()) { xp = m.extract_min(); ASSERT_FALSE( !xp ); EXPECT_EQ( xp->first.nKey, nKey + 1 ); @@ -219,7 +219,7 @@ namespace cds_test { xp = m.extract_max(); ASSERT_TRUE( !xp ); EXPECT_EQ( kkSize, nCount ); - ASSERT_TRUE( m.empty() ); + ASSERT_TRUE( m.empty()); ASSERT_CONTAINER_SIZE( m, 0 ); // extract_max @@ -229,11 +229,11 @@ namespace cds_test { EXPECT_TRUE( !xp ); for ( auto const& i : arrKeys ) - ASSERT_TRUE( m.insert( i ) ); + ASSERT_TRUE( m.insert( i )); nKey = kkSize; nCount = 0; - while ( !m.empty() ) { + while ( !m.empty()) { xp = m.extract_max(); ASSERT_FALSE( !xp ); EXPECT_EQ( xp->first.nKey, nKey - 1 ); @@ -246,7 +246,7 @@ namespace cds_test { xp = m.extract_max(); ASSERT_TRUE( !xp ); EXPECT_EQ( kkSize, nCount ); - ASSERT_TRUE( m.empty() ); + ASSERT_TRUE( m.empty()); ASSERT_CONTAINER_SIZE( m, 0 ); } }; diff --git a/test/unit/tree/test_tree_set.h b/test/unit/tree/test_tree_set.h index b64fe27e..ec4c6920 100644 --- a/test/unit/tree/test_tree_set.h +++ b/test/unit/tree/test_tree_set.h @@ -58,7 +58,7 @@ namespace cds_test { void clear_stat() { - memset( this, 0, sizeof( *this ) ); + memset( this, 0, sizeof( *this )); } }; @@ -93,7 +93,7 @@ namespace cds_test { template explicit int_item( Q const& src ) - : nKey( src.key() ) + : nKey( src.key()) , nVal( 0 ) {} @@ -106,17 +106,17 @@ namespace cds_test { int_item( int_item&& src ) : nKey( src.nKey ) , nVal( src.nVal ) - , strVal( std::move( src.strVal ) ) + , strVal( std::move( src.strVal )) {} int_item( int k, std::string&& s ) : nKey( k ) , nVal( k * 2 ) - , strVal( std::move( s ) ) + , strVal( std::move( s )) {} explicit int_item( other_item const& s ) - : nKey( s.key() ) + : nKey( s.key()) , nVal( s.key() * 2 ) {} @@ -192,7 +192,7 @@ namespace cds_test { struct cmp { int operator ()( int_item const& v1, int_item const& v2 ) const { - if ( v1.key() < v2.key() ) + if ( v1.key() < v2.key()) return -1; return v1.key() > v2.key() ? 1 : 0; } @@ -213,7 +213,7 @@ namespace cds_test { template int operator ()( int v1, T const& v2 ) const { - if ( v1 < v2.key() ) + if ( v1 < v2.key()) return -1; return v1 > v2.key() ? 1 : 0; } @@ -244,7 +244,7 @@ namespace cds_test { // Precondition: set is empty // Postcondition: set is empty - ASSERT_TRUE( s.empty() ); + ASSERT_TRUE( s.empty()); ASSERT_CONTAINER_SIZE( s, 0 ); size_t const nSetSize = kSize; @@ -255,18 +255,18 @@ namespace cds_test { data.reserve( kSize ); indices.reserve( kSize ); for ( size_t key = 0; key < kSize; ++key ) { - data.push_back( value_type( static_cast(key) ) ); + data.push_back( value_type( static_cast(key)) ); indices.push_back( key ); } - shuffle( indices.begin(), indices.end() ); + shuffle( indices.begin(), indices.end()); // insert/find for ( auto idx : indices ) { auto& i = data[idx]; - ASSERT_FALSE( s.contains( i.nKey ) ); - ASSERT_FALSE( s.contains( i ) ); - ASSERT_FALSE( s.contains( other_item( i.key() ), other_less())); + ASSERT_FALSE( s.contains( i.nKey )); + ASSERT_FALSE( s.contains( i )); + ASSERT_FALSE( s.contains( other_item( i.key()), other_less())); ASSERT_FALSE( s.find( i.nKey, []( value_type&, int ) {} )); ASSERT_FALSE( s.find( i, []( value_type&, value_type const& ) {} )); ASSERT_FALSE( s.find_with( other_item( i.key()), other_less(), []( value_type&, other_item const& ) {} )); @@ -288,14 +288,14 @@ namespace cds_test { updResult = s.update( i, []( bool bNew, value_type& val, value_type const& arg) { EXPECT_FALSE( bNew ); - EXPECT_EQ( val.key(), arg.key() ); + EXPECT_EQ( val.key(), arg.key()); }, false ); EXPECT_TRUE( updResult.first ); EXPECT_FALSE( updResult.second ); break; case 1: - ASSERT_TRUE( s.insert( i.key() )); - ASSERT_FALSE( s.insert( i.key() )); + ASSERT_TRUE( s.insert( i.key())); + ASSERT_FALSE( s.insert( i.key())); updResult = s.update( i.key(), []( bool bNew, value_type& val, int arg) { EXPECT_FALSE( bNew ); @@ -326,7 +326,7 @@ namespace cds_test { updResult = s.update( i, []( bool bNew, value_type& v, value_type const& arg ) { EXPECT_TRUE( bNew ); - EXPECT_EQ( v.key(), arg.key() ); + EXPECT_EQ( v.key(), arg.key()); ++v.nUpdateNewCount; }); EXPECT_TRUE( updResult.first ); @@ -335,7 +335,7 @@ namespace cds_test { updResult = s.update( i, []( bool bNew, value_type& v, value_type const& arg ) { EXPECT_FALSE( bNew ); - EXPECT_EQ( v.key(), arg.key() ); + EXPECT_EQ( v.key(), arg.key()); ++v.nUpdateNewCount; }, false ); EXPECT_TRUE( updResult.first ); @@ -368,7 +368,7 @@ namespace cds_test { ASSERT_TRUE( s.find( i, []( value_type const& v, value_type const& arg ) { - EXPECT_EQ( v.key(), arg.key() ); + EXPECT_EQ( v.key(), arg.key()); EXPECT_EQ( v.nUpdateNewCount, 2u ); })); break; @@ -376,7 +376,7 @@ namespace cds_test { ASSERT_TRUE( s.emplace( i.key())); ASSERT_TRUE( s.find( i, []( value_type const& v, value_type const& arg ) { - EXPECT_EQ( v.key(), arg.key() ); + EXPECT_EQ( v.key(), arg.key()); EXPECT_EQ( v.nVal, arg.nVal ); })); break; @@ -386,37 +386,37 @@ namespace cds_test { EXPECT_TRUE( str.empty()); ASSERT_TRUE( s.find( i, []( value_type const& v, value_type const& arg ) { - EXPECT_EQ( v.key(), arg.key() ); + EXPECT_EQ( v.key(), arg.key()); EXPECT_EQ( v.nVal, arg.nVal ); EXPECT_EQ( v.strVal, std::string( "Hello!" )); - } ) ); + } )); break; default: // forgot anything?.. ASSERT_TRUE( false ); } - ASSERT_TRUE( s.contains( i.nKey ) ); - ASSERT_TRUE( s.contains( i ) ); - ASSERT_TRUE( s.contains( other_item( i.key() ), other_less() ) ); - ASSERT_TRUE( s.find( i.nKey, []( value_type&, int ) {} ) ); - ASSERT_TRUE( s.find( i, []( value_type&, value_type const& ) {} ) ); - ASSERT_TRUE( s.find_with( other_item( i.key() ), other_less(), []( value_type&, other_item const& ) {} ) ); + ASSERT_TRUE( s.contains( i.nKey )); + ASSERT_TRUE( s.contains( i )); + ASSERT_TRUE( s.contains( other_item( i.key()), other_less()) ); + ASSERT_TRUE( s.find( i.nKey, []( value_type&, int ) {} )); + ASSERT_TRUE( s.find( i, []( value_type&, value_type const& ) {} )); + ASSERT_TRUE( s.find_with( other_item( i.key()), other_less(), []( value_type&, other_item const& ) {} )); } - ASSERT_FALSE( s.empty() ); + ASSERT_FALSE( s.empty()); ASSERT_CONTAINER_SIZE( s, nSetSize ); ASSERT_TRUE( s.check_consistency()); // erase - shuffle( indices.begin(), indices.end() ); + shuffle( indices.begin(), indices.end()); for ( auto idx : indices ) { auto& i = data[idx]; - ASSERT_TRUE( s.contains( i.nKey ) ); - ASSERT_TRUE( s.contains( i ) ); - ASSERT_TRUE( s.contains( other_item( i.key() ), other_less() ) ); + ASSERT_TRUE( s.contains( i.nKey )); + ASSERT_TRUE( s.contains( i )); + ASSERT_TRUE( s.contains( other_item( i.key()), other_less()) ); ASSERT_TRUE( s.find( i.nKey, []( value_type& v, int ) { v.nFindCount = 1; @@ -425,7 +425,7 @@ namespace cds_test { { EXPECT_EQ( ++v.nFindCount, 2u ); })); - ASSERT_TRUE( s.find_with( other_item( i.key() ), other_less(), []( value_type& v, other_item const& ) + ASSERT_TRUE( s.find_with( other_item( i.key()), other_less(), []( value_type& v, other_item const& ) { EXPECT_EQ( ++v.nFindCount, 3u ); })); @@ -442,7 +442,7 @@ namespace cds_test { break; case 2: ASSERT_TRUE( s.erase_with( other_item( i.key()), other_less())); - ASSERT_FALSE( s.erase_with( other_item( i.key() ), other_less() ) ); + ASSERT_FALSE( s.erase_with( other_item( i.key()), other_less()) ); break; case 3: ASSERT_TRUE( s.erase( i.key(), [&nKey]( value_type const& v ) @@ -488,28 +488,28 @@ namespace cds_test { break; } - ASSERT_FALSE( s.contains( i.nKey ) ); - ASSERT_FALSE( s.contains( i ) ); - ASSERT_FALSE( s.contains( other_item( i.key() ), other_less())); + ASSERT_FALSE( s.contains( i.nKey )); + ASSERT_FALSE( s.contains( i )); + ASSERT_FALSE( s.contains( other_item( i.key()), other_less())); ASSERT_FALSE( s.find( i.nKey, []( value_type&, int ) {} )); ASSERT_FALSE( s.find( i, []( value_type&, value_type const& ) {} )); ASSERT_FALSE( s.find_with( other_item( i.key()), other_less(), []( value_type&, other_item const& ) {} )); } - ASSERT_TRUE( s.empty() ); + ASSERT_TRUE( s.empty()); ASSERT_CONTAINER_SIZE( s, 0 ); // clear for ( auto& i : data ) { - ASSERT_TRUE( s.insert( i ) ); + ASSERT_TRUE( s.insert( i )); } - ASSERT_FALSE( s.empty() ); + ASSERT_FALSE( s.empty()); ASSERT_CONTAINER_SIZE( s, nSetSize ); s.clear(); - ASSERT_TRUE( s.empty() ); + ASSERT_TRUE( s.empty()); ASSERT_CONTAINER_SIZE( s, 0 ); } }; diff --git a/test/unit/tree/test_tree_set_hp.h b/test/unit/tree/test_tree_set_hp.h index 3ce0c3b4..2e39de5c 100644 --- a/test/unit/tree/test_tree_set_hp.h +++ b/test/unit/tree/test_tree_set_hp.h @@ -46,7 +46,7 @@ namespace cds_test { // Precondition: set is empty // Postcondition: set is empty - ASSERT_TRUE( s.empty() ); + ASSERT_TRUE( s.empty()); ASSERT_CONTAINER_SIZE( s, 0 ); base_class::test( s ); @@ -59,15 +59,15 @@ namespace cds_test { data.reserve( kSize ); indices.reserve( kSize ); for ( size_t key = 0; key < kSize; ++key ) { - data.push_back( value_type( static_cast(key) ) ); + data.push_back( value_type( static_cast(key)) ); indices.push_back( key ); } - shuffle( indices.begin(), indices.end() ); + shuffle( indices.begin(), indices.end()); for ( auto i : indices ) { - ASSERT_TRUE( s.insert( data[i] ) ); + ASSERT_TRUE( s.insert( data[i] )); } - ASSERT_FALSE( s.empty() ); + ASSERT_FALSE( s.empty()); ASSERT_CONTAINER_SIZE( s, nSetSize ); typedef typename Set::guarded_ptr guarded_ptr; @@ -80,7 +80,7 @@ namespace cds_test { ASSERT_TRUE( !gp ); switch ( idx % 3 ) { case 0: - gp = s.get( i.key() ); + gp = s.get( i.key()); ASSERT_FALSE( !gp ); break; case 1: @@ -88,10 +88,10 @@ namespace cds_test { ASSERT_FALSE( !gp ); break; case 2: - gp = s.get_with( other_item( i.key() ), other_less() ); + gp = s.get_with( other_item( i.key()), other_less()); ASSERT_FALSE( !gp ); } - EXPECT_EQ( gp->key(), i.key() ); + EXPECT_EQ( gp->key(), i.key()); gp->nFindCount = gp->key() * 3; gp.release(); @@ -104,7 +104,7 @@ namespace cds_test { ASSERT_TRUE( !gp ); switch ( idx % 3 ) { case 0: - gp = s.extract( i.key() ); + gp = s.extract( i.key()); ASSERT_FALSE( !gp ); break; case 1: @@ -112,72 +112,72 @@ namespace cds_test { ASSERT_FALSE( !gp ); break; case 2: - gp = s.extract_with( other_item( i.key() ), other_less() ); + gp = s.extract_with( other_item( i.key()), other_less()); ASSERT_FALSE( !gp ); break; } - EXPECT_EQ( gp->key(), i.key() ); + EXPECT_EQ( gp->key(), i.key()); EXPECT_EQ( gp->nFindCount, static_cast( i.key() * 3 )); switch ( idx % 3 ) { case 0: - gp = s.extract( i.key() ); + gp = s.extract( i.key()); break; case 1: gp = s.extract( i ); break; case 2: - gp = s.extract_with( other_item( i.key() ), other_less() ); + gp = s.extract_with( other_item( i.key()), other_less()); break; } ASSERT_TRUE( !gp ); } - ASSERT_TRUE( s.empty() ); + ASSERT_TRUE( s.empty()); ASSERT_CONTAINER_SIZE( s, 0 ); for ( auto i : indices ) { - ASSERT_TRUE( s.insert( data[i] ) ); + ASSERT_TRUE( s.insert( data[i] )); } - ASSERT_FALSE( s.empty() ); + ASSERT_FALSE( s.empty()); ASSERT_CONTAINER_SIZE( s, nSetSize ); // extract_min size_t nCount = 0; int nKey = -1; - while ( !s.empty() ) { + while ( !s.empty()) { gp = s.extract_min(); ASSERT_FALSE( !gp ); - EXPECT_EQ( nKey + 1, gp->key() ); + EXPECT_EQ( nKey + 1, gp->key()); ++nCount; nKey = gp->key(); } gp.release(); EXPECT_EQ( nCount, nSetSize ); - ASSERT_TRUE( s.empty() ); + ASSERT_TRUE( s.empty()); ASSERT_CONTAINER_SIZE( s, 0 ); // extract_max for ( auto i : indices ) { ASSERT_TRUE( s.insert( data[i] )); } - ASSERT_FALSE( s.empty() ); + ASSERT_FALSE( s.empty()); ASSERT_CONTAINER_SIZE( s, nSetSize ); nCount = 0; nKey = nSetSize; - while ( !s.empty() ) { + while ( !s.empty()) { gp = s.extract_max(); ASSERT_FALSE( !gp ); - EXPECT_EQ( nKey - 1, gp->key() ); + EXPECT_EQ( nKey - 1, gp->key()); ++nCount; nKey = gp->key(); } gp.release(); EXPECT_EQ( nCount, nSetSize ); - ASSERT_TRUE( s.empty() ); + ASSERT_TRUE( s.empty()); ASSERT_CONTAINER_SIZE( s, 0 ); } diff --git a/test/unit/tree/test_tree_set_rcu.h b/test/unit/tree/test_tree_set_rcu.h index 43845867..2d908080 100644 --- a/test/unit/tree/test_tree_set_rcu.h +++ b/test/unit/tree/test_tree_set_rcu.h @@ -46,7 +46,7 @@ namespace cds_test { // Precondition: set is empty // Postcondition: set is empty - ASSERT_TRUE( s.empty() ); + ASSERT_TRUE( s.empty()); ASSERT_CONTAINER_SIZE( s, 0 ); base_class::test( s ); @@ -59,15 +59,15 @@ namespace cds_test { data.reserve( kSize ); indices.reserve( kSize ); for ( size_t key = 0; key < kSize; ++key ) { - data.push_back( value_type( static_cast(key) ) ); + data.push_back( value_type( static_cast(key)) ); indices.push_back( key ); } - shuffle( indices.begin(), indices.end() ); + shuffle( indices.begin(), indices.end()); for ( auto i : indices ) { ASSERT_TRUE( s.insert( data[i] )); } - ASSERT_FALSE( s.empty() ); + ASSERT_FALSE( s.empty()); ASSERT_CONTAINER_SIZE( s, nSetSize ); typedef typename Set::exempt_ptr exempt_ptr; @@ -84,7 +84,7 @@ namespace cds_test { ASSERT_TRUE( !rp ); switch ( idx % 3 ) { case 0: - rp = s.get( i.key() ); + rp = s.get( i.key()); ASSERT_FALSE( !rp ); break; case 1: @@ -92,10 +92,10 @@ namespace cds_test { ASSERT_FALSE( !rp ); break; case 2: - rp = s.get_with( other_item( i.key() ), other_less() ); + rp = s.get_with( other_item( i.key()), other_less()); ASSERT_FALSE( !rp ); } - EXPECT_EQ( rp->key(), i.key() ); + EXPECT_EQ( rp->key(), i.key()); rp->nFindCount = rp->key() * 3; } } @@ -112,7 +112,7 @@ namespace cds_test { switch ( idx % 3 ) { case 0: - xp = s.extract( i.key() ); + xp = s.extract( i.key()); ASSERT_FALSE( !xp ); break; case 1: @@ -120,11 +120,11 @@ namespace cds_test { ASSERT_FALSE( !xp ); break; case 2: - xp = s.extract_with( other_item( i.key() ), other_less() ); + xp = s.extract_with( other_item( i.key()), other_less()); ASSERT_FALSE( !xp ); break; } - EXPECT_EQ( xp->key(), i.key() ); + EXPECT_EQ( xp->key(), i.key()); EXPECT_EQ( xp->nFindCount, static_cast( i.key() * 3 )); } xp.release(); @@ -134,13 +134,13 @@ namespace cds_test { switch ( idx % 3 ) { case 0: - xp = s.extract( i.key() ); + xp = s.extract( i.key()); break; case 1: xp = s.extract( i ); break; case 2: - xp = s.extract_with( other_item( i.key() ), other_less() ); + xp = s.extract_with( other_item( i.key()), other_less()); break; } ASSERT_TRUE( !xp ); @@ -149,7 +149,7 @@ namespace cds_test { else { switch ( idx % 3 ) { case 0: - xp = s.extract( i.key() ); + xp = s.extract( i.key()); ASSERT_FALSE( !xp ); break; case 1: @@ -157,73 +157,73 @@ namespace cds_test { ASSERT_FALSE( !xp ); break; case 2: - xp = s.extract_with( other_item( i.key() ), other_less() ); + xp = s.extract_with( other_item( i.key()), other_less()); ASSERT_FALSE( !xp ); break; } - EXPECT_EQ( xp->key(), i.key() ); + EXPECT_EQ( xp->key(), i.key()); EXPECT_EQ( xp->nFindCount, static_cast( i.key() * 3 )); switch ( idx % 3 ) { case 0: - xp = s.extract( i.key() ); + xp = s.extract( i.key()); break; case 1: xp = s.extract( i ); break; case 2: - xp = s.extract_with( other_item( i.key() ), other_less() ); + xp = s.extract_with( other_item( i.key()), other_less()); break; } ASSERT_TRUE( !xp ); } } - ASSERT_TRUE( s.empty() ); + ASSERT_TRUE( s.empty()); ASSERT_CONTAINER_SIZE( s, 0 ); for ( auto i : indices ) { - ASSERT_TRUE( s.insert( data[i] ) ); + ASSERT_TRUE( s.insert( data[i] )); } - ASSERT_FALSE( s.empty() ); + ASSERT_FALSE( s.empty()); ASSERT_CONTAINER_SIZE( s, nSetSize ); // extract_min size_t nCount = 0; int nKey = -1; - while ( !s.empty() ) { + while ( !s.empty()) { xp = s.extract_min(); ASSERT_FALSE( !xp ); - EXPECT_EQ( nKey + 1, xp->key() ); + EXPECT_EQ( nKey + 1, xp->key()); ++nCount; nKey = xp->key(); } xp.release(); EXPECT_EQ( nCount, nSetSize ); - ASSERT_TRUE( s.empty() ); + ASSERT_TRUE( s.empty()); ASSERT_CONTAINER_SIZE( s, 0 ); // extract_max for ( auto i : indices ) { - ASSERT_TRUE( s.insert( data[i] ) ); + ASSERT_TRUE( s.insert( data[i] )); } - ASSERT_FALSE( s.empty() ); + ASSERT_FALSE( s.empty()); ASSERT_CONTAINER_SIZE( s, nSetSize ); nCount = 0; nKey = nSetSize; - while ( !s.empty() ) { + while ( !s.empty()) { xp = s.extract_max(); ASSERT_FALSE( !xp ); - EXPECT_EQ( nKey - 1, xp->key() ); + EXPECT_EQ( nKey - 1, xp->key()); ++nCount; nKey = xp->key(); } xp.release(); EXPECT_EQ( nCount, nSetSize ); - ASSERT_TRUE( s.empty() ); + ASSERT_TRUE( s.empty()); ASSERT_CONTAINER_SIZE( s, 0 ); } diff --git a/tools/brush_cds.pl b/tools/brush_cds.pl index 49e46c38..f4b2e876 100644 --- a/tools/brush_cds.pl +++ b/tools/brush_cds.pl @@ -82,6 +82,7 @@ sub processFile( $ ) $nTabsFound += $_ =~ s/\t/ /g; $_ =~ s/\s+$//; $_ =~ s/\s+;$/;/; + $_ =~ s/\)\s+\)/\)\)/g; $str .= $_ ; $str .= "\n" ; }