From: khizmax Date: Sat, 29 Nov 2014 11:53:38 +0000 (+0300) Subject: Renaming map member function insert_key() to insert_with() X-Git-Tag: v2.0.0~37 X-Git-Url: http://plrg.eecs.uci.edu/git/?p=libcds.git;a=commitdiff_plain;h=1299028af6164e05fb012f668a9252e5d16d0f39 Renaming map member function insert_key() to insert_with() --- diff --git a/cds/container/cuckoo_map.h b/cds/container/cuckoo_map.h index 11885552..826b1bb5 100644 --- a/cds/container/cuckoo_map.h +++ b/cds/container/cuckoo_map.h @@ -411,7 +411,7 @@ namespace cds { namespace container { template bool insert( K const& key ) { - return insert_key( key, [](value_type&){} ); + return insert_with( key, [](value_type&){} ); } /// Inserts new node @@ -428,7 +428,7 @@ namespace cds { namespace container { template bool insert( K const& key, V const& val ) { - return insert_key( key, [&val](value_type& item) { item.second = val ; } ); + return insert_with( key, [&val](value_type& item) { item.second = val ; } ); } /// Inserts new node and initialize it by a functor @@ -457,7 +457,7 @@ namespace cds { namespace container { it is preferable that the initialization should be completed only if inserting is successful. */ template - bool insert_key( const K& key, Func func ) + bool insert_with( const K& key, Func func ) { scoped_node_ptr pNode( alloc_node( key )); if ( base_class::insert( *pNode, [&func]( node_type& item ) { func( item.m_val ); } )) { diff --git a/cds/container/ellen_bintree_map_rcu.h b/cds/container/ellen_bintree_map_rcu.h index 6ad87c11..1e8c1ae7 100644 --- a/cds/container/ellen_bintree_map_rcu.h +++ b/cds/container/ellen_bintree_map_rcu.h @@ -139,7 +139,7 @@ namespace cds { namespace container { template bool insert( K const& key ) { - return insert_key( key, [](value_type&){} ); + return insert_with( key, [](value_type&){} ); } /// Inserts new node @@ -195,7 +195,7 @@ namespace cds { namespace container { RCU \p synchronize() method can be called. RCU should not be locked. */ template - bool insert_key( const K& key, Func func ) + bool insert_with( const K& key, Func func ) { scoped_node_ptr pNode( cxx_leaf_node_allocator().New( key )); if ( base_class::insert( *pNode, [&func]( leaf_node& item ) { func( item.m_Value ); } )) { diff --git a/cds/container/impl/ellen_bintree_map.h b/cds/container/impl/ellen_bintree_map.h index 16b32a39..1d78da4b 100644 --- a/cds/container/impl/ellen_bintree_map.h +++ b/cds/container/impl/ellen_bintree_map.h @@ -137,7 +137,7 @@ namespace cds { namespace container { template bool insert( K const& key ) { - return insert_key( key, [](value_type&){} ); + return insert_with( key, [](value_type&){} ); } /// Inserts new node @@ -189,7 +189,7 @@ namespace cds { namespace container { it is preferable that the initialization should be completed only if inserting is successful. */ template - bool insert_key( const K& key, Func func ) + bool insert_with( const K& key, Func func ) { scoped_node_ptr pNode( cxx_leaf_node_allocator().New( key )); if ( base_class::insert( *pNode, [&func]( leaf_node& item ) { func( item.m_Value ); } )) { diff --git a/cds/container/impl/lazy_kvlist.h b/cds/container/impl/lazy_kvlist.h index e8b83f7a..579b475e 100644 --- a/cds/container/impl/lazy_kvlist.h +++ b/cds/container/impl/lazy_kvlist.h @@ -406,9 +406,9 @@ namespace cds { namespace container { it is preferable that the initialization should be completed only if inserting is successful. */ template - bool insert_key( const K& key, Func func ) + bool insert_with( const K& key, Func func ) { - return insert_key_at( head(), key, func ); + return insert_with_at( head(), key, func ); } /// Inserts data of type \ref mapped_type constructed with std::forward(args)... @@ -730,7 +730,7 @@ namespace cds { namespace container { } template - bool insert_key_at( head_type& refHead, const K& key, Func f ) + bool insert_with_at( head_type& refHead, const K& key, Func f ) { scoped_node_ptr pNode( alloc_node( key )); diff --git a/cds/container/impl/michael_kvlist.h b/cds/container/impl/michael_kvlist.h index a31103e4..6218f695 100644 --- a/cds/container/impl/michael_kvlist.h +++ b/cds/container/impl/michael_kvlist.h @@ -399,9 +399,9 @@ namespace cds { namespace container { @warning See \ref cds_intrusive_item_creating "insert item troubleshooting" */ template - bool insert_key( const K& key, Func func ) + bool insert_with( const K& key, Func func ) { - return insert_key_at( head(), key, func ); + return insert_with_at( head(), key, func ); } /// Ensures that the \p key exists in the list @@ -740,7 +740,7 @@ namespace cds { namespace container { } template - bool insert_key_at( head_type& refHead, const K& key, Func f ) + bool insert_with_at( head_type& refHead, const K& key, Func f ) { scoped_node_ptr pNode( alloc_node( key )); diff --git a/cds/container/impl/skip_list_map.h b/cds/container/impl/skip_list_map.h index 0d311726..9d0bb2ac 100644 --- a/cds/container/impl/skip_list_map.h +++ b/cds/container/impl/skip_list_map.h @@ -220,7 +220,7 @@ namespace cds { namespace container { template bool insert( K const& key ) { - return insert_key( key, [](value_type&){} ); + return insert_with( key, [](value_type&){} ); } /// Inserts new node @@ -237,7 +237,7 @@ namespace cds { namespace container { template bool insert( K const& key, V const& val ) { - return insert_key( key, [&val](value_type& item) { item.second = val ; } ); + return insert_with( key, [&val](value_type& item) { item.second = val ; } ); } /// Inserts new node and initialize it by a functor @@ -266,7 +266,7 @@ namespace cds { namespace container { it is preferable that the initialization should be completed only if inserting is successful. */ template - bool insert_key( const K& key, Func func ) + bool insert_with( const K& key, Func func ) { scoped_node_ptr pNode( node_allocator().New( random_level(), key )); if ( base_class::insert( *pNode, [&func]( node_type& item ) { func( item.m_Value ); } )) { diff --git a/cds/container/lazy_kvlist_nogc.h b/cds/container/lazy_kvlist_nogc.h index b5a9df89..66a46574 100644 --- a/cds/container/lazy_kvlist_nogc.h +++ b/cds/container/lazy_kvlist_nogc.h @@ -368,9 +368,9 @@ namespace cds { namespace container { Returns an iterator pointed to inserted value, or \p end() if inserting is failed */ template - iterator insert_key( const K& key, Func func ) + iterator insert_with( const K& key, Func func ) { - return node_to_iterator( insert_key_at( head(), key, func )); + return node_to_iterator( insert_with_at( head(), key, func )); } /// Ensures that the key \p key exists in the list @@ -478,7 +478,7 @@ namespace cds { namespace container { } template - node_type * insert_key_at( head_type& refHead, const K& key, Func f ) + node_type * insert_with_at( head_type& refHead, const K& key, Func f ) { scoped_node_ptr pNode( alloc_node( key )); diff --git a/cds/container/lazy_kvlist_rcu.h b/cds/container/lazy_kvlist_rcu.h index 40f234f0..6c7fd54c 100644 --- a/cds/container/lazy_kvlist_rcu.h +++ b/cds/container/lazy_kvlist_rcu.h @@ -392,9 +392,9 @@ namespace cds { namespace container { @warning See \ref cds_intrusive_item_creating "insert item troubleshooting" */ template - bool insert_key( const K& key, Func func ) + bool insert_with( const K& key, Func func ) { - return insert_key_at( head(), key, func ); + return insert_with_at( head(), key, func ); } /// Inserts data of type \p mapped_type constructed from \p args @@ -740,7 +740,7 @@ namespace cds { namespace container { } template - bool insert_key_at( head_type& refHead, const K& key, Func f ) + bool insert_with_at( head_type& refHead, const K& key, Func f ) { scoped_node_ptr pNode( alloc_node( key )); diff --git a/cds/container/michael_kvlist_nogc.h b/cds/container/michael_kvlist_nogc.h index 15a14dfa..3634a704 100644 --- a/cds/container/michael_kvlist_nogc.h +++ b/cds/container/michael_kvlist_nogc.h @@ -386,9 +386,9 @@ namespace cds { namespace container { Returns an iterator pointed to inserted value, or \p end() if inserting is failed */ template - iterator insert_key( const K& key, Func func ) + iterator insert_with( const K& key, Func func ) { - return node_to_iterator( insert_key_at( head(), key, func )); + return node_to_iterator( insert_with_at( head(), key, func )); } /// Ensures that the key \p key exists in the list @@ -493,7 +493,7 @@ namespace cds { namespace container { } template - node_type * insert_key_at( head_type& refHead, const K& key, Func f ) + node_type * insert_with_at( head_type& refHead, const K& key, Func f ) { scoped_node_ptr pNode( alloc_node( key )); diff --git a/cds/container/michael_kvlist_rcu.h b/cds/container/michael_kvlist_rcu.h index 7545e48c..4733f999 100644 --- a/cds/container/michael_kvlist_rcu.h +++ b/cds/container/michael_kvlist_rcu.h @@ -385,9 +385,9 @@ namespace cds { namespace container { @warning See \ref cds_intrusive_item_creating "insert item troubleshooting" */ template - bool insert_key( const K& key, Func func ) + bool insert_with( const K& key, Func func ) { - return insert_key_at( head(), key, func ); + return insert_with_at( head(), key, func ); } /// Ensures that the \p key exists in the list @@ -739,7 +739,7 @@ namespace cds { namespace container { } template - bool insert_key_at( head_type& refHead, const K& key, Func f ) + bool insert_with_at( head_type& refHead, const K& key, Func f ) { scoped_node_ptr pNode( alloc_node( key )); diff --git a/cds/container/michael_map.h b/cds/container/michael_map.h index a090a6d4..ba411b73 100644 --- a/cds/container/michael_map.h +++ b/cds/container/michael_map.h @@ -462,9 +462,9 @@ namespace cds { namespace container { synchronization. */ template - bool insert_key( const K& key, Func func ) + bool insert_with( const K& key, Func func ) { - const bool bRet = bucket( key ).insert_key( key, func ); + const bool bRet = bucket( key ).insert_with( key, func ); if ( bRet ) ++m_ItemCounter; return bRet; diff --git a/cds/container/michael_map_nogc.h b/cds/container/michael_map_nogc.h index cfa193e8..e541b178 100644 --- a/cds/container/michael_map_nogc.h +++ b/cds/container/michael_map_nogc.h @@ -351,10 +351,10 @@ namespace cds { namespace container { synchronization. */ template - iterator insert_key( const K& key, Func func ) + iterator insert_with( const K& key, Func func ) { bucket_type& refBucket = bucket( key ); - bucket_iterator it = refBucket.insert_key( key, func ); + bucket_iterator it = refBucket.insert_with( key, func ); if ( it != refBucket.end() ) { ++m_ItemCounter; diff --git a/cds/container/michael_map_rcu.h b/cds/container/michael_map_rcu.h index 8888759a..5dc469b8 100644 --- a/cds/container/michael_map_rcu.h +++ b/cds/container/michael_map_rcu.h @@ -382,9 +382,9 @@ namespace cds { namespace container { synchronization. */ template - bool insert_key( const K& key, Func func ) + bool insert_with( const K& key, Func func ) { - const bool bRet = bucket( key ).insert_key( key, func ); + const bool bRet = bucket( key ).insert_with( key, func ); if ( bRet ) ++m_ItemCounter; return bRet; diff --git a/cds/container/skip_list_map_nogc.h b/cds/container/skip_list_map_nogc.h index 916de567..7745b7ea 100644 --- a/cds/container/skip_list_map_nogc.h +++ b/cds/container/skip_list_map_nogc.h @@ -211,7 +211,7 @@ namespace cds { namespace container { Returns an iterator pointed to inserted value, or \p end() if inserting is failed */ template - iterator insert_key( K const& key, Func func ) + iterator insert_with( K const& key, Func func ) { iterator it = insert( key ); if ( it != end() ) diff --git a/cds/container/skip_list_map_rcu.h b/cds/container/skip_list_map_rcu.h index 74192804..e47917c3 100644 --- a/cds/container/skip_list_map_rcu.h +++ b/cds/container/skip_list_map_rcu.h @@ -221,7 +221,7 @@ namespace cds { namespace container { template bool insert( K const& key ) { - return insert_key( key, [](value_type&){} ); + return insert_with( key, [](value_type&){} ); } /// Inserts new node @@ -275,7 +275,7 @@ namespace cds { namespace container { RCU \p synchronize method can be called. RCU should not be locked. */ template - bool insert_key( const K& key, Func func ) + bool insert_with( const K& key, Func func ) { scoped_node_ptr pNode( node_allocator().New( random_level(), key )); if ( base_class::insert( *pNode, [&func]( node_type& item ) { func( item.m_Value ); } )) { diff --git a/cds/container/split_list_map.h b/cds/container/split_list_map.h index de219d16..86040560 100644 --- a/cds/container/split_list_map.h +++ b/cds/container/split_list_map.h @@ -290,7 +290,7 @@ namespace cds { namespace container { synchronization. */ template - bool insert_key( K const& key, Func func ) + 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, mapped_type() ), func ); diff --git a/cds/container/split_list_map_nogc.h b/cds/container/split_list_map_nogc.h index ba7efc5c..0922ef39 100644 --- a/cds/container/split_list_map_nogc.h +++ b/cds/container/split_list_map_nogc.h @@ -203,7 +203,7 @@ namespace cds { namespace container { Returns an iterator pointed to inserted value, or \p end() if inserting is failed */ template - iterator insert_key( const K& key, Func func ) + iterator insert_with( const K& key, Func func ) { iterator it = insert( key ); if ( it != end() ) diff --git a/cds/container/split_list_map_rcu.h b/cds/container/split_list_map_rcu.h index 3354a1f9..d0aac448 100644 --- a/cds/container/split_list_map_rcu.h +++ b/cds/container/split_list_map_rcu.h @@ -326,7 +326,7 @@ namespace cds { namespace container { The function applies RCU lock internally. */ template - bool insert_key( K const& key, Func func ) + 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, mapped_type() ), func ); diff --git a/cds/container/striped_map.h b/cds/container/striped_map.h index ce9a2325..8969d5be 100644 --- a/cds/container/striped_map.h +++ b/cds/container/striped_map.h @@ -560,7 +560,7 @@ template template bool insert( K const& key ) { - return insert_key( key, [](value_type&){} ); + return insert_with( key, [](value_type&){} ); } /// Inserts new node @@ -577,7 +577,7 @@ template template bool insert( K const& key, V const& val ) { - return insert_key( key, [&val](value_type& item) { item.second = val ; } ); + return insert_with( key, [&val](value_type& item) { item.second = val ; } ); } /// Inserts new node and initialize it by a functor @@ -606,7 +606,7 @@ template it is preferable that the initialization should be completed only if inserting is successful. */ template - bool insert_key( const K& key, Func func ) + bool insert_with( const K& key, Func func ) { return base_class::insert( key, func ); } diff --git a/tests/test-hdr/map/hdr_cuckoo_map.h b/tests/test-hdr/map/hdr_cuckoo_map.h index 40310cf7..92065c08 100644 --- a/tests/test-hdr/map/hdr_cuckoo_map.h +++ b/tests/test-hdr/map/hdr_cuckoo_map.h @@ -241,14 +241,14 @@ namespace map { CPPUNIT_ASSERT( check_size( m, 2 )); CPPUNIT_ASSERT( !m.find(30) ); - CPPUNIT_ASSERT( m.insert_key( 30, insert_functor() ) ) ; // value = 90 + CPPUNIT_ASSERT( m.insert_with( 30, insert_functor() ) ) ; // value = 90 CPPUNIT_ASSERT( !m.empty() ); CPPUNIT_ASSERT( check_size( m, 3 )); CPPUNIT_ASSERT( m.find(30) ); - CPPUNIT_ASSERT( !m.insert_key( 10, insert_functor() ) ); - CPPUNIT_ASSERT( !m.insert_key( 25, insert_functor() ) ); - CPPUNIT_ASSERT( !m.insert_key( 30, insert_functor() ) ); + CPPUNIT_ASSERT( !m.insert_with( 10, insert_functor() ) ); + CPPUNIT_ASSERT( !m.insert_with( 25, insert_functor() ) ); + CPPUNIT_ASSERT( !m.insert_with( 30, insert_functor() ) ); // ensure (new key) CPPUNIT_ASSERT( !m.find(27) ); diff --git a/tests/test-hdr/map/hdr_map.h b/tests/test-hdr/map/hdr_map.h index 1441b46c..ec6ed42c 100644 --- a/tests/test-hdr/map/hdr_map.h +++ b/tests/test-hdr/map/hdr_map.h @@ -375,14 +375,14 @@ namespace map { CPPUNIT_ASSERT( check_size( m, 2 )); CPPUNIT_ASSERT( !m.find(30) ); - CPPUNIT_ASSERT( m.insert_key( 30, insert_functor() ) ) ; // value = 90 + CPPUNIT_ASSERT( m.insert_with( 30, insert_functor() ) ) ; // value = 90 CPPUNIT_ASSERT( !m.empty() ); CPPUNIT_ASSERT( check_size( m, 3 )); CPPUNIT_ASSERT( m.find(30) ); - CPPUNIT_ASSERT( !m.insert_key( 10, insert_functor() ) ); - CPPUNIT_ASSERT( !m.insert_key( 25, insert_functor() ) ); - CPPUNIT_ASSERT( !m.insert_key( 30, insert_functor() ) ); + CPPUNIT_ASSERT( !m.insert_with( 10, insert_functor() ) ); + CPPUNIT_ASSERT( !m.insert_with( 25, insert_functor() ) ); + CPPUNIT_ASSERT( !m.insert_with( 30, insert_functor() ) ); // ensure (new key) CPPUNIT_ASSERT( !m.find(27) ); @@ -514,7 +514,7 @@ namespace map { CPPUNIT_ASSERT( it->second.m_val == 200 ); CPPUNIT_ASSERT( m.find(55) == m.end() ); - it = m.insert_key( 55, insert_functor() ); + it = m.insert_with( 55, insert_functor() ); CPPUNIT_ASSERT( it != m.end() ); CPPUNIT_ASSERT( !m.empty() ); CPPUNIT_ASSERT( check_size( m, 3 )); @@ -524,7 +524,7 @@ namespace map { CPPUNIT_ASSERT( m.insert( 55 ) == m.end() ); CPPUNIT_ASSERT( m.insert( 55, 10 ) == m.end() ); - CPPUNIT_ASSERT( m.insert_key( 55, insert_functor()) == m.end() ); + CPPUNIT_ASSERT( m.insert_with( 55, insert_functor()) == m.end() ); CPPUNIT_ASSERT( m.find(10) != m.end() ); std::pair ensureResult = m.ensure( 10 ); diff --git a/tests/test-hdr/map/hdr_skiplist_map.h b/tests/test-hdr/map/hdr_skiplist_map.h index 7d5db329..e21aaaa3 100644 --- a/tests/test-hdr/map/hdr_skiplist_map.h +++ b/tests/test-hdr/map/hdr_skiplist_map.h @@ -263,7 +263,7 @@ namespace map { CPPUNIT_ASSERT( it->second.m_val == 200 ); CPPUNIT_ASSERT( m.find(55) == m.end() ); - it = m.insert_key( 55, insert_functor() ); + it = m.insert_with( 55, insert_functor() ); CPPUNIT_ASSERT( it != m.end() ); CPPUNIT_ASSERT( !m.empty() ); CPPUNIT_ASSERT( check_size( m, 3 )); @@ -273,7 +273,7 @@ namespace map { CPPUNIT_ASSERT( m.insert( 55 ) == m.end() ); CPPUNIT_ASSERT( m.insert( 55, 10 ) == m.end() ); - CPPUNIT_ASSERT( m.insert_key( 55, insert_functor()) == m.end() ); + CPPUNIT_ASSERT( m.insert_with( 55, insert_functor()) == m.end() ); CPPUNIT_ASSERT( m.find(10) != m.end() ); std::pair ensureResult = m.ensure( 10 ); diff --git a/tests/test-hdr/map/hdr_striped_map.h b/tests/test-hdr/map/hdr_striped_map.h index 54749027..06b3c87f 100644 --- a/tests/test-hdr/map/hdr_striped_map.h +++ b/tests/test-hdr/map/hdr_striped_map.h @@ -189,14 +189,14 @@ namespace map { CPPUNIT_ASSERT( check_size( m, 2 )); CPPUNIT_ASSERT( !m.find(30) ); - CPPUNIT_ASSERT( m.insert_key( 30, insert_functor() ) ) ; // value = 90 + CPPUNIT_ASSERT( m.insert_with( 30, insert_functor() ) ) ; // value = 90 CPPUNIT_ASSERT( !m.empty() ); CPPUNIT_ASSERT( check_size( m, 3 )); CPPUNIT_ASSERT( m.find(30) ); - CPPUNIT_ASSERT( !m.insert_key( 10, insert_functor() ) ); - CPPUNIT_ASSERT( !m.insert_key( 25, insert_functor() ) ); - CPPUNIT_ASSERT( !m.insert_key( 30, insert_functor() ) ); + CPPUNIT_ASSERT( !m.insert_with( 10, insert_functor() ) ); + CPPUNIT_ASSERT( !m.insert_with( 25, insert_functor() ) ); + CPPUNIT_ASSERT( !m.insert_with( 30, insert_functor() ) ); // ensure (new key) CPPUNIT_ASSERT( !m.find(27) ); @@ -394,14 +394,14 @@ namespace map { CPPUNIT_ASSERT( check_size( m, 2 )); CPPUNIT_ASSERT( !m.find(30) ); - CPPUNIT_ASSERT( m.insert_key( 30, insert_functor() ) ) ; // value = 90 + CPPUNIT_ASSERT( m.insert_with( 30, insert_functor() ) ) ; // value = 90 CPPUNIT_ASSERT( !m.empty() ); CPPUNIT_ASSERT( check_size( m, 3 )); CPPUNIT_ASSERT( m.find(30) ); - CPPUNIT_ASSERT( !m.insert_key( 10, insert_functor() ) ); - CPPUNIT_ASSERT( !m.insert_key( 25, insert_functor() ) ); - CPPUNIT_ASSERT( !m.insert_key( 30, insert_functor() ) ); + CPPUNIT_ASSERT( !m.insert_with( 10, insert_functor() ) ); + CPPUNIT_ASSERT( !m.insert_with( 25, insert_functor() ) ); + CPPUNIT_ASSERT( !m.insert_with( 30, insert_functor() ) ); // ensure (new key) CPPUNIT_ASSERT( !m.find(27) ); diff --git a/tests/test-hdr/ordered_list/hdr_lazy_kv.h b/tests/test-hdr/ordered_list/hdr_lazy_kv.h index 3a8509a2..e62dcf3b 100644 --- a/tests/test-hdr/ordered_list/hdr_lazy_kv.h +++ b/tests/test-hdr/ordered_list/hdr_lazy_kv.h @@ -132,7 +132,7 @@ namespace ordlist { CPPUNIT_ASSERT( !l.empty() ); CPPUNIT_ASSERT( !l.find( 150 )); - CPPUNIT_ASSERT( l.insert_key( 150, insert_functor() )); + CPPUNIT_ASSERT( l.insert_with( 150, insert_functor() )); CPPUNIT_ASSERT( l.find( 150 )); chk.m_nExpected = 1500; CPPUNIT_ASSERT( l.find_with( 150, lt(), std::ref( chk ) ) ); @@ -175,7 +175,7 @@ namespace ordlist { // erase test CPPUNIT_ASSERT( !l.empty() ); - CPPUNIT_ASSERT( l.insert_key( 200, insert_functor() )); + CPPUNIT_ASSERT( l.insert_with( 200, insert_functor() )); CPPUNIT_ASSERT( l.insert( 25 )); CPPUNIT_ASSERT( l.erase( 100 )); CPPUNIT_ASSERT( l.erase( 150 )); @@ -492,7 +492,7 @@ namespace ordlist { CPPUNIT_ASSERT( !l.empty() ); CPPUNIT_ASSERT( l.find( 150 ) == l.end() ); - CPPUNIT_ASSERT( l.insert_key( 150, insert_functor() ) != l.end() ); + CPPUNIT_ASSERT( l.insert_with( 150, insert_functor() ) != l.end() ); it = l.find( 150 ); CPPUNIT_ASSERT( it != l.end() ); CPPUNIT_ASSERT( it.key() == 150 ); diff --git a/tests/test-hdr/ordered_list/hdr_michael_kv.h b/tests/test-hdr/ordered_list/hdr_michael_kv.h index e4acdf8b..d51a08f8 100644 --- a/tests/test-hdr/ordered_list/hdr_michael_kv.h +++ b/tests/test-hdr/ordered_list/hdr_michael_kv.h @@ -132,7 +132,7 @@ namespace ordlist { CPPUNIT_ASSERT( !l.empty() ); CPPUNIT_ASSERT( !l.find( 150 )); - CPPUNIT_ASSERT( l.insert_key( 150, insert_functor() )); + CPPUNIT_ASSERT( l.insert_with( 150, insert_functor() )); CPPUNIT_ASSERT( l.find( 150 )); chk.m_nExpected = 1500; CPPUNIT_ASSERT( l.find( 150, std::ref( chk ) ) ); @@ -175,7 +175,7 @@ namespace ordlist { // erase test CPPUNIT_ASSERT( !l.empty() ); - CPPUNIT_ASSERT( l.insert_key( 200, insert_functor() )); + CPPUNIT_ASSERT( l.insert_with( 200, insert_functor() )); CPPUNIT_ASSERT( l.insert( 25 )); CPPUNIT_ASSERT( l.erase( 100 )); CPPUNIT_ASSERT( l.erase( 150 )); @@ -505,7 +505,7 @@ namespace ordlist { CPPUNIT_ASSERT( !l.empty() ); CPPUNIT_ASSERT( l.find( 150 ) == l.end() ); - CPPUNIT_ASSERT( l.insert_key( 150, insert_functor() ) != l.end() ); + CPPUNIT_ASSERT( l.insert_with( 150, insert_functor() ) != l.end() ); it = l.find( 150 ); CPPUNIT_ASSERT( it != l.end() ); CPPUNIT_ASSERT( it.key() == 150 ); diff --git a/tests/test-hdr/tree/hdr_ellenbintree_map.h b/tests/test-hdr/tree/hdr_ellenbintree_map.h index d4849aa2..d2c90519 100644 --- a/tests/test-hdr/tree/hdr_ellenbintree_map.h +++ b/tests/test-hdr/tree/hdr_ellenbintree_map.h @@ -245,14 +245,14 @@ namespace tree { CPPUNIT_ASSERT( check_size( m, 2 )); CPPUNIT_ASSERT( !m.find(30) ); - CPPUNIT_ASSERT( m.insert_key( 30, insert_functor() ) ) ; // value = 90 + CPPUNIT_ASSERT( m.insert_with( 30, insert_functor() ) ) ; // value = 90 CPPUNIT_ASSERT( !m.empty() ); CPPUNIT_ASSERT( check_size( m, 3 )); CPPUNIT_ASSERT( m.find(30) ); - CPPUNIT_ASSERT( !m.insert_key( 10, insert_functor() ) ); - CPPUNIT_ASSERT( !m.insert_key( 25, insert_functor() ) ); - CPPUNIT_ASSERT( !m.insert_key( 30, insert_functor() ) ); + CPPUNIT_ASSERT( !m.insert_with( 10, insert_functor() ) ); + CPPUNIT_ASSERT( !m.insert_with( 25, insert_functor() ) ); + CPPUNIT_ASSERT( !m.insert_with( 30, insert_functor() ) ); // ensure (new key) CPPUNIT_ASSERT( !m.find(27) ); diff --git a/tests/unit/map2/map_insdel_func.cpp b/tests/unit/map2/map_insdel_func.cpp index 46b53ddd..aa09a1dd 100644 --- a/tests/unit/map2/map_insdel_func.cpp +++ b/tests/unit/map2/map_insdel_func.cpp @@ -139,7 +139,7 @@ namespace map2 { if ( m_nThreadNo & 1 ) { for ( size_t nPass = 0; nPass < c_nThreadPassCount; ++nPass ) { for ( key_array::const_iterator it = arr.begin(), itEnd = arr.end(); it != itEnd; ++it ) { - if ( rMap.insert_key( *it, std::ref(func) ) ) + if ( rMap.insert_with( *it, std::ref(func) ) ) ++m_nInsertSuccess; else ++m_nInsertFailed; @@ -149,7 +149,7 @@ namespace map2 { else { for ( size_t nPass = 0; nPass < c_nThreadPassCount; ++nPass ) { for ( key_array::const_reverse_iterator it = arr.rbegin(), itEnd = arr.rend(); it != itEnd; ++it ) { - if ( rMap.insert_key( *it, std::ref(func) ) ) + if ( rMap.insert_with( *it, std::ref(func) ) ) ++m_nInsertSuccess; else ++m_nInsertFailed; diff --git a/tests/unit/map2/map_types.h b/tests/unit/map2/map_types.h index 44c6494d..837570f6 100644 --- a/tests/unit/map2/map_types.h +++ b/tests/unit/map2/map_types.h @@ -301,9 +301,9 @@ namespace map2 { } template - bool insert_key( K const& key, Func func ) + bool insert_with( K const& key, Func func ) { - return base_class::insert_key( key, func ) != base_class::end(); + return base_class::insert_with( key, func ) != base_class::end(); } template @@ -339,9 +339,9 @@ namespace map2 { } template - bool insert_key( K const& key, Func func ) + bool insert_with( K const& key, Func func ) { - return base_class::insert_key( key, func ) != base_class::end(); + return base_class::insert_with( key, func ) != base_class::end(); } template @@ -374,9 +374,9 @@ namespace map2 { } template - bool insert_key( K const& key, Func func ) + bool insert_with( K const& key, Func func ) { - return base_class::insert_key( key, func ) != base_class::end(); + return base_class::insert_with( key, func ) != base_class::end(); } template