Added intrusive IterableList
authorkhizmax <libcds.dev@gmail.com>
Tue, 19 Jul 2016 20:58:49 +0000 (23:58 +0300)
committerkhizmax <libcds.dev@gmail.com>
Tue, 19 Jul 2016 20:58:49 +0000 (23:58 +0300)
cds/intrusive/impl/iterable_list.h
test/unit/list/test_intrusive_iterable_list.h

index a1a8d1d6857ac2bda53cf5b540adb2a316dec329..66e018c310260910ac58cb08ef0dcac9665f3a84 100644 (file)
@@ -464,7 +464,7 @@ namespace cds { namespace intrusive {
         */
         std::pair<bool, bool> 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
index 00c5c9839f1abe4e79a4f6f49ee6e8f14051a373..3bdfaa68403c7c957bb365fdfecfebb9212e5aef 100644 (file)
@@ -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<bool, bool> 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 ));