Fixed compatibility with boost 1.59 for striped intrusive sets
[libcds.git] / tests / test-hdr / set / hdr_intrusive_refinable_hashset_sgset.cpp
index 0ce2ee6b738427cd3b492ebd747b04ae1ce4817d..d9b0eccc72f20ec258511ed4d8fd1f2e50092568 100644 (file)
@@ -10,12 +10,32 @@ namespace set {
     namespace {
         typedef IntrusiveStripedSetHdrTest::base_item< bi::bs_set_base_hook<> > base_item_type;
         typedef IntrusiveStripedSetHdrTest::member_item< bi::bs_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::Refinable_sg_set_basehook()
     {
         typedef ci::StripedSet<
-            bi::sg_set<base_item_type, bi::compare<IntrusiveStripedSetHdrTest::less<base_item_type> > >
+            bi::sg_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::mutex_policy< ci::striped_set::refinable<> >
         > set_type;
@@ -26,7 +46,10 @@ namespace set {
     void IntrusiveStripedSetHdrTest::Refinable_sg_set_basehook_bucket_threshold()
     {
         typedef ci::StripedSet<
-            bi::sg_set<base_item_type, bi::compare<IntrusiveStripedSetHdrTest::less<base_item_type> > >
+            bi::sg_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> >
             ,co::mutex_policy< ci::striped_set::refinable<> >
@@ -38,7 +61,10 @@ namespace set {
     void IntrusiveStripedSetHdrTest::Refinable_sg_set_basehook_bucket_threshold_rt()
     {
         typedef ci::StripedSet<
-            bi::sg_set<base_item_type, bi::compare<IntrusiveStripedSetHdrTest::less<base_item_type> > >
+            bi::sg_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> >
             ,co::mutex_policy< ci::striped_set::refinable<> >
@@ -55,6 +81,7 @@ namespace set {
                 member_item_type
                 , bi::member_hook< member_item_type, bi::bs_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::mutex_policy< ci::striped_set::refinable<> >
             ,co::hash< IntrusiveStripedSetHdrTest::hash_int >
@@ -70,6 +97,7 @@ namespace set {
                 member_item_type
                 , bi::member_hook< member_item_type, bi::bs_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> >
@@ -86,6 +114,7 @@ namespace set {
                 member_item_type
                 , bi::member_hook< member_item_type, bi::bs_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> >