From: khizmax Date: Tue, 19 Jul 2016 20:58:49 +0000 (+0300) Subject: Added intrusive IterableList X-Git-Tag: v2.2.0~189 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=b4bed58430619c53564634905c5062562232ae9e;p=libcds.git Added intrusive IterableList --- diff --git a/cds/intrusive/impl/iterable_list.h b/cds/intrusive/impl/iterable_list.h index a1a8d1d6..66e018c3 100644 --- a/cds/intrusive/impl/iterable_list.h +++ b/cds/intrusive/impl/iterable_list.h @@ -464,7 +464,7 @@ namespace cds { namespace intrusive { */ std::pair update( value_type& val, bool bInsert = true ) { - return update_at( m_pHead, val, []( value_type&, value_type* ) {}, bINsert ); + return update_at( m_pHead, val, []( value_type&, value_type* ) {}, bInsert ); } /// Unlinks the item \p val from the list diff --git a/test/unit/list/test_intrusive_iterable_list.h b/test/unit/list/test_intrusive_iterable_list.h index 00c5c983..3bdfaa68 100644 --- a/test/unit/list/test_intrusive_iterable_list.h +++ b/test/unit/list/test_intrusive_iterable_list.h @@ -246,7 +246,7 @@ namespace cds_test { EXPECT_FALSE( l.find_with( other_item( i.nKey ), other_less(), []( value_type& item, other_item const& ) { ++item.s.nFindCall; } )); EXPECT_EQ( i.s.nFindCall, 0 ); - switch ( i.nKey % 3 ) { + switch ( i.nKey % 4 ) { case 0: EXPECT_TRUE( l.insert( i )); break; @@ -276,6 +276,17 @@ namespace cds_test { EXPECT_EQ( ret.second, true ); } break; + case 3: + { + std::pair ret = l.update( i, false ); + EXPECT_EQ( ret.first, false ); + EXPECT_EQ( ret.second, false ); + + ret = l.update( i ); + EXPECT_EQ( ret.first, true ); + EXPECT_EQ( ret.second, true ); + } + break; } EXPECT_TRUE( l.contains( i.nKey ));