Fixed compatibility with boost 1.59 for striped intrusive sets
[libcds.git] / tests / test-hdr / set / hdr_intrusive_striped_hashset_set.cpp
index c97a89ca8251779f9132992981fa4bd8b7334e48..ac29ba1c80a120ce4bb5285bdccd7e6c698c2301 100644 (file)
@@ -10,12 +10,33 @@ namespace set {
     namespace {
         typedef IntrusiveStripedSetHdrTest::base_item< bi::set_base_hook<> > base_item_type;
         typedef IntrusiveStripedSetHdrTest::member_item< bi::set_member_hook<> > member_item_type;
+
+        template <typename T, typename Node>
+        struct get_key
+        {
+            typedef T type;
+
+            type const& operator()( Node const& v ) const
+            {
+                return v.nKey;
+            }
+        };
     }
 
+#if BOOST_VERSION >= 105900
+#   define CDS_BOOST_INTRUSIVE_KEY_OF_VALUE_OPTION( type ) ,bi::key_of_value< get_key< int, type>>
+#else
+#   define CDS_BOOST_INTRUSIVE_KEY_OF_VALUE_OPTION( type )
+#endif
+
+
     void IntrusiveStripedSetHdrTest::Striped_set_basehook()
     {
         typedef ci::StripedSet<
-            bi::set<base_item_type, bi::compare<IntrusiveStripedSetHdrTest::less<base_item_type> > >
+            bi::set<base_item_type
+                , bi::compare<IntrusiveStripedSetHdrTest::less<base_item_type>>
+                CDS_BOOST_INTRUSIVE_KEY_OF_VALUE_OPTION( base_item_type )
+            >
             ,co::mutex_policy< ci::striped_set::striping<> >
             ,co::hash< IntrusiveStripedSetHdrTest::hash_int >
         > set_type;
@@ -26,7 +47,10 @@ namespace set {
     void IntrusiveStripedSetHdrTest::Striped_set_basehook_bucket_threshold()
     {
         typedef ci::StripedSet<
-            bi::set<base_item_type, bi::compare<IntrusiveStripedSetHdrTest::less<base_item_type> > >
+            bi::set<base_item_type
+                , bi::compare<IntrusiveStripedSetHdrTest::less<base_item_type>>
+                CDS_BOOST_INTRUSIVE_KEY_OF_VALUE_OPTION( base_item_type )
+            >
             ,co::hash< IntrusiveStripedSetHdrTest::hash_int >
             ,co::resizing_policy< ci::striped_set::single_bucket_size_threshold<64> >
         > set_type;
@@ -37,7 +61,10 @@ namespace set {
     void IntrusiveStripedSetHdrTest::Striped_set_basehook_bucket_threshold_rt()
     {
         typedef ci::StripedSet<
-            bi::set<base_item_type, bi::compare<IntrusiveStripedSetHdrTest::less<base_item_type> > >
+            bi::set<base_item_type
+                , bi::compare<IntrusiveStripedSetHdrTest::less<base_item_type>>
+                CDS_BOOST_INTRUSIVE_KEY_OF_VALUE_OPTION( base_item_type )
+            >
             ,co::hash< IntrusiveStripedSetHdrTest::hash_int >
             ,co::resizing_policy< ci::striped_set::single_bucket_size_threshold<0> >
         > set_type;
@@ -53,6 +80,7 @@ namespace set {
                 member_item_type
                 , bi::member_hook< member_item_type, bi::set_member_hook<>, &member_item_type::hMember>
                 , bi::compare<IntrusiveStripedSetHdrTest::less<member_item_type> >
+                CDS_BOOST_INTRUSIVE_KEY_OF_VALUE_OPTION( member_item_type )
             >
             ,co::hash< IntrusiveStripedSetHdrTest::hash_int >
         > set_type;
@@ -67,6 +95,7 @@ namespace set {
                 member_item_type
                 , bi::member_hook< member_item_type, bi::set_member_hook<>, &member_item_type::hMember>
                 , bi::compare<IntrusiveStripedSetHdrTest::less<member_item_type> >
+                CDS_BOOST_INTRUSIVE_KEY_OF_VALUE_OPTION( member_item_type )
             >
             ,co::hash< IntrusiveStripedSetHdrTest::hash_int >
             ,co::resizing_policy< ci::striped_set::single_bucket_size_threshold<256> >
@@ -82,6 +111,7 @@ namespace set {
                 member_item_type
                 , bi::member_hook< member_item_type, bi::set_member_hook<>, &member_item_type::hMember>
                 , bi::compare<IntrusiveStripedSetHdrTest::less<member_item_type> >
+                CDS_BOOST_INTRUSIVE_KEY_OF_VALUE_OPTION( member_item_type )
             >
             ,co::hash< IntrusiveStripedSetHdrTest::hash_int >
             ,co::resizing_policy< ci::striped_set::single_bucket_size_threshold<0> >