From b4bed58430619c53564634905c5062562232ae9e Mon Sep 17 00:00:00 2001 From: khizmax Date: Tue, 19 Jul 2016 23:58:49 +0300 Subject: [PATCH] Added intrusive IterableList --- cds/intrusive/impl/iterable_list.h | 2 +- test/unit/list/test_intrusive_iterable_list.h | 13 ++++++++++++- 2 files changed, 13 insertions(+), 2 deletions(-) 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 )); -- 2.34.1