template <typename Ky, typename... Args>
node_type( Ky&& key, Args&&... args )
- : m_Data( key_type( std::forward<Ky>( key )), std::move( mapped_type( std::forward<Args>( args )... )) )
+ : m_Data( key_type( std::forward<Ky>( key )), std::move( mapped_type( std::forward<Args>( args )... )))
{}
};
template <typename Q>
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 <typename Q>
typename std::enable_if<Sort, iterator>::type contains( Q const& key, Less pred )
{
CDS_UNUSED( pred );
- return node_to_iterator( find_at( head(), key, typename maker::template less_wrapper<Less>::type()) );
+ return node_to_iterator( find_at( head(), key, typename maker::template less_wrapper<Less>::type()));
}
//@cond
template <typename Q, typename Less, bool Sort = c_bSort>
typename std::enable_if<!Sort, iterator>::type contains( Q const& key, Equal equal )
{
CDS_UNUSED( equal );
- return node_to_iterator( find_at( head(), key, typename maker::template equal_to_wrapper<Equal>::type()) );
+ return node_to_iterator( find_at( head(), key, typename maker::template equal_to_wrapper<Equal>::type()));
}
//@cond
template <typename Q, typename Equal, bool Sort = c_bSort>
template <typename Q>
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 <typename Q>
iterator contains( Q const& key, Less pred )
{
CDS_UNUSED( pred );
- return node_to_iterator( find_at( head(), key, typename maker::template less_wrapper<Less>::type()) );
+ return node_to_iterator( find_at( head(), key, typename maker::template less_wrapper<Less>::type()));
}
//@cond
template <typename Q, typename Less>
iterator contains( Q const& key, Less pred )
{
CDS_UNUSED( pred );
- return node_to_iterator( find_at( head(), key, typename maker::template less_wrapper<Less>::type()) );
+ return node_to_iterator( find_at( head(), key, typename maker::template less_wrapper<Less>::type()));
}
//@cond
template <typename Q, typename Less>
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<bucket_stat>( it );
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<bucket_stat>( it );
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<bucket_stat>( it );
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<bucket_stat>( it );
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;
}
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
{
std::swap(
map.insert(
- std::map::value_type( itWhat->first, T()) ).first->second
+ std::map::value_type( itWhat->first, T())).first->second
, itWhat->second
));
}
std::pair<bool, bool> update( const Q& key, Func func, bool bAllowInsert )
{
if ( bAllowInsert ) {
- std::pair<iterator, bool> res = m_Map.insert( value_type( key_type( key ), mapped_type()) );
+ std::pair<iterator, bool> res = m_Map.insert( value_type( key_type( key ), mapped_type()));
func( res.second, const_cast<value_type&>(*res.first));
return std::make_pair( true, res.second );
}
template <typename Q, typename Func>
bool insert( const Q& key, Func f )
{
- std::pair<iterator, bool> res = m_Map.insert( value_type( key_type( key ), mapped_type()) );
+ std::pair<iterator, bool> res = m_Map.insert( value_type( key_type( key ), mapped_type()));
if ( res.second )
f( *res.first );
return res.second;
template <typename Q, typename Func>
bool insert( const Q& key, Func f )
{
- std::pair<iterator, bool> res = m_Map.insert( value_type( key_type( key ), mapped_type()) );
+ std::pair<iterator, bool> res = m_Map.insert( value_type( key_type( key ), mapped_type()));
if ( res.second )
f( *res.first );
return res.second;
template <typename T>
void retirePtr( T * p, void (* pFunc)(T *))
{
- retirePtr( retired_ptr( reinterpret_cast<void *>( p ), reinterpret_cast<free_retired_ptr_func>( pFunc )) );
+ retirePtr( retired_ptr( reinterpret_cast<void *>( p ), reinterpret_cast<free_retired_ptr_func>( pFunc )));
}
/// Places retired pointer \p into thread's array of retired pointer for deferred reclamation
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<leaf_node *>( pLeaf )) );
+ free_leaf_node( node_traits::to_value_ptr( static_cast<leaf_node *>( pLeaf )));
free_internal_node( pParent );
}
}
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 ));
> 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 ));
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;
}
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;
}
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 );
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 );
// 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 );
}
assert( gc::is_locked());
while ( true ) {
- if ( search( pos.refHead, val, pos, key_comparator()) ) {
+ 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 );
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<bucket_stat>( it );
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<bucket_stat>( it );
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()
/// Push superblock descriptor to free-list
void push( T * pDesc )
{
- assert( base_class::node_algorithms::inited( static_cast<item_hook *>(pDesc)) );
+ assert( base_class::node_algorithms::inited( static_cast<item_hook *>(pDesc)));
auto_lock al(m_access);
base_class::push_back( *pDesc );
}
return nullptr;
T& rDesc = base_class::front();
base_class::pop_front();
- assert( base_class::node_algorithms::inited( static_cast<item_hook *>(&rDesc)) );
+ assert( base_class::node_algorithms::inited( static_cast<item_hook *>(&rDesc)));
return &rDesc;
}
void push( T * pDesc )
{
auto_lock al( m_access );
- assert( base_class::node_algorithms::inited( static_cast<item_hook *>(pDesc)) );
+ assert( base_class::node_algorithms::inited( static_cast<item_hook *>(pDesc)));
base_class::push_back( *pDesc );
}
return nullptr;
T& rDesc = base_class::front();
base_class::pop_front();
- assert( base_class::node_algorithms::inited( static_cast<item_hook *>(&rDesc)) );
+ assert( base_class::node_algorithms::inited( static_cast<item_hook *>(&rDesc)));
return &rDesc;
}
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<item_hook *>(pDesc)) ) {
+ if ( !base_class::node_algorithms::inited( static_cast<item_hook *>(pDesc))) {
base_class::erase( base_class::iterator_to( *pDesc ));
return true;
}
} while ( !pPartial.compare_exchange_weak( pDesc, nullptr, atomics::memory_order_release, atomics::memory_order_relaxed ));
//assert( pDesc == nullptr || free_desc_list<superblock_desc>::node_algorithms::inited( static_cast<sb_free_list_hook *>(pDesc)));
- //assert( pDesc == nullptr || partial_desc_list<superblock_desc>::node_algorithms::inited( static_cast<sb_partial_list_hook *>(pDesc)) );
+ //assert( pDesc == nullptr || partial_desc_list<superblock_desc>::node_algorithms::inited( static_cast<sb_partial_list_hook *>(pDesc)));
return pDesc;
}
void add_partial( superblock_desc * pDesc )
{
assert( pPartial != pDesc );
- //assert( partial_desc_list<superblock_desc>::node_algorithms::inited( static_cast<sb_partial_list_hook *>(pDesc)) );
+ //assert( partial_desc_list<superblock_desc>::node_algorithms::inited( static_cast<sb_partial_list_hook *>(pDesc)));
superblock_desc * pCur = nullptr;
if ( !pPartial.compare_exchange_strong(pCur, pDesc, atomics::memory_order_acq_rel, atomics::memory_order_relaxed))
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-- ) {
/// 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 );
/// 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;
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
{
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;
}
}
}
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
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
bool insert( const Key& key, const T& val, Func func )
{
scoped_lock al( m_lock );
- std::pair<typename base_class::iterator, bool> pRet = base_class::insert( typename base_class::value_type( key, Value()) );
+ std::pair<typename base_class::iterator, bool> pRet = base_class::insert( typename base_class::value_type( key, Value()));
if ( pRet.second ) {
func( pRet.first->second, val );
return true;
std::pair<bool, bool> update( const T& key, Func func, bool /*bAllowInsert*/ = true )
{
scoped_lock al( m_lock );
- std::pair<typename base_class::iterator, bool> pRet = base_class::insert( typename base_class::value_type( key, Value()) );
+ std::pair<typename base_class::iterator, bool> pRet = base_class::insert( typename base_class::value_type( key, Value()));
if ( pRet.second ) {
func( true, *pRet.first );
return std::make_pair( true, true );
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
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
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 );
data.reserve( nSetSize );
indices.reserve( nSetSize );
for ( size_t key = 0; key < nSetSize; ++key ) {
- data.push_back( value_type( static_cast<int>(key)) );
+ data.push_back( value_type( static_cast<int>(key)));
indices.push_back( key );
}
shuffle( indices.begin(), indices.end());
data.reserve( nSetSize );
indices.reserve( nSetSize );
for ( size_t key = 0; key < nSetSize; ++key ) {
- data.push_back( value_type( static_cast<int>(key)) );
+ data.push_back( value_type( static_cast<int>(key)));
indices.push_back( key );
}
shuffle( indices.begin(), indices.end());
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( 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 );
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 ));
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 );
data.reserve( kSize );
indices.reserve( kSize );
for ( size_t key = 0; key < kSize; ++key ) {
- data.push_back( value_type( static_cast<int>(key)) );
+ data.push_back( value_type( static_cast<int>(key)));
indices.push_back( key );
}
shuffle( indices.begin(), indices.end());
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( 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 );
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 ));
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 );
data.reserve( kSize );
indices.reserve( kSize );
for ( size_t key = 0; key < kSize; ++key ) {
- data.push_back( value_type( static_cast<int>(key)) );
+ data.push_back( value_type( static_cast<int>(key)));
indices.push_back( key );
}
shuffle( indices.begin(), indices.end());
data.reserve( kSize );
indices.reserve( kSize );
for ( size_t key = 0; key < kSize; ++key ) {
- data.push_back( value_type( static_cast<int>(key)) );
+ data.push_back( value_type( static_cast<int>(key)));
indices.push_back( key );
}
shuffle( indices.begin(), indices.end());
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( 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 );
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 ));
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 );
data.reserve( kSize );
indices.reserve( kSize );
for ( size_t key = 0; key < kSize; ++key ) {
- data.push_back( value_type( static_cast<int>(key)) );
+ data.push_back( value_type( static_cast<int>(key)));
indices.push_back( key );
}
shuffle( indices.begin(), indices.end());
} ));
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 );
case 14:
{
std::string str = val.strVal;
- ASSERT_TRUE( m.emplace( i, std::move( str )) );
+ ASSERT_TRUE( m.emplace( i, std::move( str )));
ASSERT_TRUE( str.empty());
str = val.strVal;
- ASSERT_FALSE( m.emplace( i, std::move( str )) );
+ 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( 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_FALSE( m.emplace( i, i.nKey, std::move( str )));
ASSERT_TRUE( str.empty());
}
break;
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_CONTAINER_SIZE( q, 0u );
for ( size_t i = 0; i < nSize; ++i ) {
- ASSERT_TRUE( q.push( static_cast<value_type>(i)) );
+ ASSERT_TRUE( q.push( static_cast<value_type>(i)));
}
ASSERT_FALSE( q.empty());
ASSERT_CONTAINER_SIZE( q, nSize );
// clear
for ( size_t i = 0; i < nSize; ++i ) {
- ASSERT_TRUE( q.push( static_cast<value_type>(i)) );
+ ASSERT_TRUE( q.push( static_cast<value_type>(i)));
}
ASSERT_FALSE( q.empty());
ASSERT_CONTAINER_SIZE( q, nSize );
// clear
for ( size_t i = 0; i < nSize; ++i ) {
- ASSERT_TRUE( q.push( static_cast<value_type>(i)) );
+ ASSERT_TRUE( q.push( static_cast<value_type>(i)));
}
ASSERT_FALSE( q.empty());
ASSERT_CONTAINER_SIZE( q, nSize );
data.reserve( kSize );
indices.reserve( kSize );
for ( size_t key = 0; key < kSize; ++key ) {
- data.push_back( value_type( static_cast<int>(key)) );
+ data.push_back( value_type( static_cast<int>(key)));
indices.push_back( key );
}
shuffle( indices.begin(), indices.end());
} ));
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 )) );
+ ASSERT_TRUE( s.emplace( i.key(), std::move( str )));
EXPECT_TRUE( str.empty());
ASSERT_TRUE( s.find( i.key(), []( value_type const& v )
{
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 )
data.reserve( kSize );
indices.reserve( kSize );
for ( size_t key = 0; key < kSize; ++key ) {
- data.push_back( value_type( static_cast<int>(key)) );
+ data.push_back( value_type( static_cast<int>(key)));
indices.push_back( key );
}
shuffle( indices.begin(), indices.end());
data.reserve( kSize );
indices.reserve( kSize );
for ( size_t key = 0; key < kSize; ++key ) {
- data.push_back( value_type( static_cast<int>(key)) );
+ data.push_back( value_type( static_cast<int>(key)));
indices.push_back( key );
}
shuffle( indices.begin(), indices.end());
data.reserve( kSize );
indices.reserve( kSize );
for ( size_t key = 0; key < kSize; ++key ) {
- data.push_back( value_type( static_cast<int>(key)) );
+ data.push_back( value_type( static_cast<int>(key)));
indices.push_back( key );
}
shuffle( indices.begin(), indices.end());
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( 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.contains( other_item( i.key()), other_less()));
EXPECT_TRUE( s.find( i.nKey, []( value_type& v, int )
{
v.nFindCount = 1;
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 )
data.reserve( kSize );
indices.reserve( kSize );
for ( size_t key = 0; key < kSize; ++key ) {
- data.push_back( value_type( static_cast<int>(key)) );
+ data.push_back( value_type( static_cast<int>(key)));
indices.push_back( key );
}
shuffle( indices.begin(), indices.end());
data.reserve( kSize );
indices.reserve( kSize );
for ( size_t key = 0; key < kSize; ++key ) {
- data.push_back( value_type( static_cast<int>(key)) );
+ data.push_back( value_type( static_cast<int>(key)));
indices.push_back( key );
}
shuffle( indices.begin(), indices.end());
data.reserve( kSize );
indices.reserve( kSize );
for ( size_t key = 0; key < kSize; ++key ) {
- data.push_back( value_type( static_cast<int>(key)) );
+ data.push_back( value_type( static_cast<int>(key)));
indices.push_back( key );
}
shuffle( indices.begin(), indices.end());
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( 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.contains( other_item( i.key()), other_less()));
ASSERT_TRUE( s.find( i.nKey, []( value_type& v, int )
{
v.nFindCount = 1;
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 )
data.reserve( kSize );
indices.reserve( kSize );
for ( size_t key = 0; key < kSize; ++key ) {
- data.push_back( value_type( static_cast<int>(key)) );
+ data.push_back( value_type( static_cast<int>(key)));
indices.push_back( key );
}
shuffle( indices.begin(), indices.end());
data.reserve( kSize );
indices.reserve( kSize );
for ( size_t key = 0; key < kSize; ++key ) {
- data.push_back( value_type( static_cast<int>(key)) );
+ data.push_back( value_type( static_cast<int>(key)));
indices.push_back( key );
}
shuffle( indices.begin(), indices.end());
data.reserve( kSize );
indices.reserve( kSize );
for ( size_t key = 0; key < kSize; ++key ) {
- data.push_back( value_type( static_cast<int>(key)) );
+ data.push_back( value_type( static_cast<int>(key)));
indices.push_back( key );
}
shuffle( indices.begin(), indices.end());
data.reserve( nSetSize );
indices.reserve( nSetSize );
for ( size_t key = 0; key < nSetSize; ++key ) {
- data.push_back( value_type( static_cast<int>(key)) );
+ data.push_back( value_type( static_cast<int>(key)));
indices.push_back( key );
}
shuffle( indices.begin(), indices.end());
data.reserve( kSize );
indices.reserve( kSize );
for ( size_t key = 0; key < kSize; ++key ) {
- data.push_back( value_type( static_cast<int>(key)) );
+ data.push_back( value_type( static_cast<int>(key)));
indices.push_back( key );
}
shuffle( indices.begin(), indices.end());
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( 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.contains( other_item( i.key()), other_less()));
EXPECT_TRUE( s.find( i.nKey, []( value_type& v, int )
{
v.nFindCount = 1;
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 )
data.reserve( kSize );
indices.reserve( kSize );
for ( size_t key = 0; key < kSize; ++key ) {
- data.push_back( value_type( static_cast<int>(key)) );
+ data.push_back( value_type( static_cast<int>(key)));
indices.push_back( key );
}
shuffle( indices.begin(), indices.end());
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( 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 );
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 ));
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 );
data.reserve( kSize );
indices.reserve( kSize );
for ( size_t key = 0; key < kSize; ++key ) {
- data.push_back( value_type( static_cast<int>(key)) );
+ data.push_back( value_type( static_cast<int>(key)));
indices.push_back( key );
}
shuffle( indices.begin(), indices.end());
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( 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.contains( other_item( i.key()), other_predicate()));
ASSERT_TRUE( s.find( i.nKey, []( value_type& v, int )
{
v.nFindCount = 1;
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 )
data.reserve( kSize );
indices.reserve( kSize );
for ( size_t key = 0; key < kSize; ++key ) {
- data.push_back( value_type( static_cast<int>(key)) );
+ data.push_back( value_type( static_cast<int>(key)));
indices.push_back( key );
}
shuffle( indices.begin(), indices.end());
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 );
} ));
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());
break;
case 7:
str = "Hello!";
- ASSERT_TRUE( s.emplace( i.key(), std::move( str )) );
+ 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 )
{
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_TRUE( t.contains( i.nKey ));
ASSERT_TRUE( t.contains( i ));
- ASSERT_TRUE( t.contains( other_item( i.key()), other_less()) );
+ 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 );
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 ));
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 );
data.reserve( kSize );
indices.reserve( kSize );
for ( size_t key = 0; key < kSize; ++key ) {
- data.push_back( value_type( static_cast<int>(key)) );
+ data.push_back( value_type( static_cast<int>(key)));
indices.push_back( key );
}
shuffle( indices.begin(), indices.end());
data.reserve( kSize );
indices.reserve( kSize );
for ( size_t key = 0; key < kSize; ++key ) {
- data.push_back( value_type( static_cast<int>(key)) );
+ data.push_back( value_type( static_cast<int>(key)));
indices.push_back( key );
}
shuffle( indices.begin(), indices.end());
data.reserve( kSize );
indices.reserve( kSize );
for ( size_t key = 0; key < kSize; ++key ) {
- data.push_back( value_type( static_cast<int>(key)) );
+ data.push_back( value_type( static_cast<int>(key)));
indices.push_back( key );
}
shuffle( indices.begin(), indices.end());
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( 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.contains( other_item( i.key()), other_less()));
ASSERT_TRUE( s.find( i.nKey, []( value_type& v, int )
{
v.nFindCount = 1;
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 )
data.reserve( kSize );
indices.reserve( kSize );
for ( size_t key = 0; key < kSize; ++key ) {
- data.push_back( value_type( static_cast<int>(key)) );
+ data.push_back( value_type( static_cast<int>(key)));
indices.push_back( key );
}
shuffle( indices.begin(), indices.end());
data.reserve( kSize );
indices.reserve( kSize );
for ( size_t key = 0; key < kSize; ++key ) {
- data.push_back( value_type( static_cast<int>(key)) );
+ data.push_back( value_type( static_cast<int>(key)));
indices.push_back( key );
}
shuffle( indices.begin(), indices.end());