Replace cds::ref/boost::ref with std::ref, remove cds::unref and cds/ref.h header
[libcds.git] / tests / test-hdr / set / hdr_striped_set.h
index 70e201a83cabdc9beb3ab5858b6c106685d5987a..36d22b70ad64889d2fbd3a766477a9894af78e0e 100644 (file)
@@ -8,7 +8,7 @@
 
 #include <cds/opt/hash.h>
 #include <cds/os/timer.h>
-#include <cds/ref.h>
+#include <functional>   // ref
 #include <algorithm>    // random_shuffle
 
 // forward namespace declaration
@@ -83,8 +83,6 @@ namespace set {
                 return *this;
             }
 
-
-#ifdef CDS_MOVE_SEMANTICS_SUPPORT
             item( item&& i )
                 : nKey( i.nKey )
                 , nVal( i.nVal )
@@ -96,7 +94,6 @@ namespace set {
             //    nVal = i.nVal;
             //    return *this;
             //}
-#endif
 
             int key() const
             {
@@ -370,7 +367,7 @@ namespace set {
             {
                 copy_found<item> f;
                 key = 20;
-                CPPUNIT_ASSERT( s.find( key, boost::ref(f) ) );
+                CPPUNIT_ASSERT( s.find( key, std::ref( f ) ) );
                 CPPUNIT_ASSERT( f.m_found.nKey == 20 );
                 CPPUNIT_ASSERT( f.m_found.nVal == 25 );
                 CPPUNIT_ASSERT( f.m_found.nFindCount == 1 );
@@ -379,7 +376,7 @@ namespace set {
                 copy_found<item> f;
                 key = 20;
                 CPPUNIT_ASSERT( s.find( key, find_functor() ) );
-                CPPUNIT_ASSERT( s.find( key, boost::ref(f) ) );
+                CPPUNIT_ASSERT( s.find( key, std::ref( f ) ) );
                 CPPUNIT_ASSERT( f.m_found.nKey == 20 );
                 CPPUNIT_ASSERT( f.m_found.nVal == 25 );
                 CPPUNIT_ASSERT( f.m_found.nFindCount == 2 );
@@ -394,7 +391,7 @@ namespace set {
             {
                 copy_found<item> f;
                 key = 25;
-                CPPUNIT_ASSERT( s.find( key, boost::ref(f) ) );
+                CPPUNIT_ASSERT( s.find( key, std::ref( f ) ) );
                 CPPUNIT_ASSERT( f.m_found.nKey == 25 );
                 CPPUNIT_ASSERT( f.m_found.nVal == 2500 );
             }
@@ -403,7 +400,7 @@ namespace set {
             key = 10;
             {
                 copy_found<item> f;
-                CPPUNIT_ASSERT( s.find( key, boost::ref(f) ) );
+                CPPUNIT_ASSERT( s.find( key, std::ref( f ) ) );
                 CPPUNIT_ASSERT( f.m_found.nKey == 10 );
                 CPPUNIT_ASSERT( f.m_found.nVal == 10 );
                 CPPUNIT_ASSERT( f.m_found.nEnsureCount == 0 );
@@ -415,7 +412,7 @@ namespace set {
             CPPUNIT_ASSERT( check_size( s, 3 ));
             {
                 copy_found<item> f;
-                CPPUNIT_ASSERT( s.find( key, boost::ref(f) ) );
+                CPPUNIT_ASSERT( s.find( key, std::ref( f ) ) );
                 CPPUNIT_ASSERT( f.m_found.nKey == 10 );
                 CPPUNIT_ASSERT( f.m_found.nVal == 10 );
                 CPPUNIT_ASSERT( f.m_found.nEnsureCount == 1 );
@@ -429,7 +426,7 @@ namespace set {
             {
                 copy_found<item> f;
                 key = 13;
-                CPPUNIT_ASSERT( s.find( key, boost::ref(f) ) );
+                CPPUNIT_ASSERT( s.find( key, std::ref( f ) ) );
                 CPPUNIT_ASSERT( f.m_found.nKey == 13 );
                 CPPUNIT_ASSERT( f.m_found.nVal == 1300 );
                 CPPUNIT_ASSERT( f.m_found.nEnsureCount == 0 );
@@ -457,12 +454,12 @@ namespace set {
             CPPUNIT_ASSERT( s.find(20) );
             {
                 copy_found<item> f;
-                CPPUNIT_ASSERT( s.erase( 20, boost::ref(f) ));
+                CPPUNIT_ASSERT( s.erase( 20, std::ref( f ) ) );
                 CPPUNIT_ASSERT( f.m_found.nKey == 20 );
                 CPPUNIT_ASSERT( f.m_found.nVal == 25 );
 
                 CPPUNIT_ASSERT( s.insert(235))
-                    CPPUNIT_ASSERT( s.erase( 235, boost::ref(f) ));
+                    CPPUNIT_ASSERT( s.erase( 235, std::ref( f ) ) );
                 CPPUNIT_ASSERT( f.m_found.nKey == 235 );
                 CPPUNIT_ASSERT( f.m_found.nVal == 235 );
             }
@@ -474,7 +471,6 @@ namespace set {
             CPPUNIT_ASSERT( s.empty() );
             CPPUNIT_ASSERT( check_size( s, 0 ));
 
-#       ifdef CDS_EMPLACE_SUPPORT
             // emplace test
             CPPUNIT_ASSERT( s.emplace( 151 )) ;  // key = 151,  val = 151
             CPPUNIT_ASSERT( s.emplace( 174, 471 )) ;    // key = 174, val = 471
@@ -489,17 +485,17 @@ namespace set {
             {
                 copy_found<item> f;
                 key = 151;
-                CPPUNIT_ASSERT( s.find( key, boost::ref(f) ) );
+                CPPUNIT_ASSERT( s.find( key, std::ref( f ) ) );
                 CPPUNIT_ASSERT( f.m_found.nKey == 151 );
                 CPPUNIT_ASSERT( f.m_found.nVal == 151 );
 
                 key = 174;
-                CPPUNIT_ASSERT( s.find( key, boost::ref(f) ) );
+                CPPUNIT_ASSERT( s.find( key, std::ref( f ) ) );
                 CPPUNIT_ASSERT( f.m_found.nKey == 174 );
                 CPPUNIT_ASSERT( f.m_found.nVal == 471 );
 
                 key = 190;
-                CPPUNIT_ASSERT( s.find( key, boost::ref(f) ) );
+                CPPUNIT_ASSERT( s.find( key, std::ref( f ) ) );
                 CPPUNIT_ASSERT( f.m_found.nKey == 190 );
                 CPPUNIT_ASSERT( f.m_found.nVal == 91 );
             }
@@ -507,7 +503,6 @@ namespace set {
             s.clear();
             CPPUNIT_ASSERT( s.empty() );
             CPPUNIT_ASSERT( check_size( s, 0 ));
-#       endif
         }
 
         template <class Set>
@@ -564,7 +559,7 @@ namespace set {
             {
                 copy_found<item> f;
                 key = 20;
-                CPPUNIT_ASSERT( s.find( key, boost::ref(f) ) );
+                CPPUNIT_ASSERT( s.find( key, std::ref( f ) ) );
                 CPPUNIT_ASSERT( f.m_found.nKey == 20 );
                 CPPUNIT_ASSERT( f.m_found.nVal == 25 );
                 CPPUNIT_ASSERT( f.m_found.nFindCount == 1 );
@@ -573,7 +568,7 @@ namespace set {
                 copy_found<item> f;
                 key = 20;
                 CPPUNIT_ASSERT( s.find_with( 20, less<value_type>(), find_functor() ) );
-                CPPUNIT_ASSERT( s.find( key, boost::ref(f) ) );
+                CPPUNIT_ASSERT( s.find( key, std::ref( f ) ) );
                 CPPUNIT_ASSERT( f.m_found.nKey == 20 );
                 CPPUNIT_ASSERT( f.m_found.nVal == 25 );
                 CPPUNIT_ASSERT( f.m_found.nFindCount == 2 );
@@ -588,7 +583,7 @@ namespace set {
             {
                 copy_found<item> f;
                 key = 25;
-                CPPUNIT_ASSERT( s.find( key, boost::ref(f) ) );
+                CPPUNIT_ASSERT( s.find( key, std::ref( f ) ) );
                 CPPUNIT_ASSERT( f.m_found.nKey == 25 );
                 CPPUNIT_ASSERT( f.m_found.nVal == 2500 );
             }
@@ -597,7 +592,7 @@ namespace set {
             key = 10;
             {
                 copy_found<item> f;
-                CPPUNIT_ASSERT( s.find( key, boost::ref(f) ) );
+                CPPUNIT_ASSERT( s.find( key, std::ref( f ) ) );
                 CPPUNIT_ASSERT( f.m_found.nKey == 10 );
                 CPPUNIT_ASSERT( f.m_found.nVal == 10 );
                 CPPUNIT_ASSERT( f.m_found.nEnsureCount == 0 );
@@ -609,7 +604,7 @@ namespace set {
             CPPUNIT_ASSERT( check_size( s, 3 ));
             {
                 copy_found<item> f;
-                CPPUNIT_ASSERT( s.find( key, boost::ref(f) ) );
+                CPPUNIT_ASSERT( s.find( key, std::ref( f ) ) );
                 CPPUNIT_ASSERT( f.m_found.nKey == 10 );
                 CPPUNIT_ASSERT( f.m_found.nVal == 10 );
                 CPPUNIT_ASSERT( f.m_found.nEnsureCount == 1 );
@@ -623,7 +618,7 @@ namespace set {
             {
                 copy_found<item> f;
                 key = 13;
-                CPPUNIT_ASSERT( s.find( key, boost::ref(f) ) );
+                CPPUNIT_ASSERT( s.find( key, std::ref( f ) ) );
                 CPPUNIT_ASSERT( f.m_found.nKey == 13 );
                 CPPUNIT_ASSERT( f.m_found.nVal == 1300 );
                 CPPUNIT_ASSERT( f.m_found.nEnsureCount == 0 );
@@ -651,12 +646,12 @@ namespace set {
             CPPUNIT_ASSERT( s.find(20) );
             {
                 copy_found<item> f;
-                CPPUNIT_ASSERT( s.erase( 20, boost::ref(f) ));
+                CPPUNIT_ASSERT( s.erase( 20, std::ref( f ) ) );
                 CPPUNIT_ASSERT( f.m_found.nKey == 20 );
                 CPPUNIT_ASSERT( f.m_found.nVal == 25 );
 
                 CPPUNIT_ASSERT( s.insert(235))
-                CPPUNIT_ASSERT( s.erase_with( 235, less<value_type>(), boost::ref(f) ));
+                    CPPUNIT_ASSERT( s.erase_with( 235, less<value_type>(), std::ref( f ) ) );
                 CPPUNIT_ASSERT( f.m_found.nKey == 235 );
                 CPPUNIT_ASSERT( f.m_found.nVal == 235 );
             }
@@ -668,7 +663,6 @@ namespace set {
             CPPUNIT_ASSERT( s.empty() );
             CPPUNIT_ASSERT( check_size( s, 0 ));
 
-#       ifdef CDS_EMPLACE_SUPPORT
             // emplace test
             CPPUNIT_ASSERT( s.emplace( 151 )) ;  // key = 151,  val = 151
             CPPUNIT_ASSERT( s.emplace( 174, 471 )) ;    // key = 174, val = 471
@@ -683,17 +677,17 @@ namespace set {
             {
                 copy_found<item> f;
                 key = 151;
-                CPPUNIT_ASSERT( s.find( key, boost::ref(f) ) );
+                CPPUNIT_ASSERT( s.find( key, std::ref( f ) ) );
                 CPPUNIT_ASSERT( f.m_found.nKey == 151 );
                 CPPUNIT_ASSERT( f.m_found.nVal == 151 );
 
                 key = 174;
-                CPPUNIT_ASSERT( s.find( key, boost::ref(f) ) );
+                CPPUNIT_ASSERT( s.find( key, std::ref( f ) ) );
                 CPPUNIT_ASSERT( f.m_found.nKey == 174 );
                 CPPUNIT_ASSERT( f.m_found.nVal == 471 );
 
                 key = 190;
-                CPPUNIT_ASSERT( s.find( key, boost::ref(f) ) );
+                CPPUNIT_ASSERT( s.find( key, std::ref( f ) ) );
                 CPPUNIT_ASSERT( f.m_found.nKey == 190 );
                 CPPUNIT_ASSERT( f.m_found.nVal == 91 );
             }
@@ -701,7 +695,6 @@ namespace set {
             s.clear();
             CPPUNIT_ASSERT( s.empty() );
             CPPUNIT_ASSERT( check_size( s, 0 ));
-#       endif
         }
 
         void Striped_list();