Fixed explicit ctor bugs in stress tests
[libcds.git] / test / stress / map / map_type_feldman_hashmap.h
index 1cafd837e59a5d66f3063ed4ad839d3f9438be50..c6026064fbf6107a9d5041cb420ec703e6d0d75b 100644 (file)
@@ -5,7 +5,7 @@
 
     Source code repo: http://github.com/khizmax/libcds/
     Download: http://sourceforge.net/projects/libcds/files/
 
     Source code repo: http://github.com/khizmax/libcds/
     Download: http://sourceforge.net/projects/libcds/files/
-    
+
     Redistribution and use in source and binary forms, with or without
     modification, are permitted provided that the following conditions are met:
 
     Redistribution and use in source and binary forms, with or without
     modification, are permitted provided that the following conditions are met:
 
@@ -25,7 +25,7 @@
     SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
     CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
     OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
     SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
     CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
     OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-    OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.     
+    OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
 
 #ifndef CDSUNIT_MAP_TYPE_FELDMAN_HASHMAP_H
 */
 
 #ifndef CDSUNIT_MAP_TYPE_FELDMAN_HASHMAP_H
@@ -47,6 +47,12 @@ namespace map {
     {
         typedef cc::FeldmanHashMap< GC, Key, T, Traits > base_class;
     public:
     {
         typedef cc::FeldmanHashMap< GC, Key, T, Traits > base_class;
     public:
+
+        template <typename OtherTraits>
+        struct rebind_traits {
+            typedef FeldmanHashMap<GC, Key, T, OtherTraits > result;
+        };
+
         template <typename Config>
         FeldmanHashMap( Config const& cfg)
             : base_class( cfg.s_nFeldmanMap_HeadBits, cfg.s_nFeldmanMap_ArrayBits )
         template <typename Config>
         FeldmanHashMap( Config const& cfg)
             : base_class( cfg.s_nFeldmanMap_HeadBits, cfg.s_nFeldmanMap_ArrayBits )
@@ -69,7 +75,8 @@ namespace map {
 
         struct traits_FeldmanHashMap_stdhash : public cc::feldman_hashmap::traits
         {
 
         struct traits_FeldmanHashMap_stdhash : public cc::feldman_hashmap::traits
         {
-            typedef std::hash< Key > hash;
+            typedef std::hash< Key >    hash;
+            typedef std::less<size_t>   less;
         };
 
         typedef FeldmanHashMap< cds::gc::HP,  Key, Value, traits_FeldmanHashMap_stdhash >    FeldmanHashMap_hp_stdhash;
         };
 
         typedef FeldmanHashMap< cds::gc::HP,  Key, Value, traits_FeldmanHashMap_stdhash >    FeldmanHashMap_hp_stdhash;
@@ -85,6 +92,7 @@ namespace map {
         struct traits_FeldmanHashMap_stdhash_stat: traits_FeldmanHashMap_stdhash
         {
             typedef cc::feldman_hashmap::stat<> stat;
         struct traits_FeldmanHashMap_stdhash_stat: traits_FeldmanHashMap_stdhash
         {
             typedef cc::feldman_hashmap::stat<> stat;
+            typedef std::less<size_t>   less;
         };
 
         typedef FeldmanHashMap< cds::gc::HP,  Key, Value, traits_FeldmanHashMap_stdhash_stat >    FeldmanHashMap_hp_stdhash_stat;
         };
 
         typedef FeldmanHashMap< cds::gc::HP,  Key, Value, traits_FeldmanHashMap_stdhash_stat >    FeldmanHashMap_hp_stdhash_stat;
@@ -160,28 +168,33 @@ namespace map {
 
 
         // for fixed-sized keys - no hash functor required
 
 
         // for fixed-sized keys - no hash functor required
-        typedef FeldmanHashMap< cds::gc::HP, Key, Value >    FeldmanHashMap_hp_fixed;
-        typedef FeldmanHashMap< cds::gc::DHP, Key, Value >   FeldmanHashMap_dhp_fixed;
-        typedef FeldmanHashMap< rcu_gpi, Key, Value >    FeldmanHashMap_rcu_gpi_fixed;
-        typedef FeldmanHashMap< rcu_gpb, Key, Value >    FeldmanHashMap_rcu_gpb_fixed;
-        typedef FeldmanHashMap< rcu_gpt, Key, Value >    FeldmanHashMap_rcu_gpt_fixed;
+        struct traits_FeldmanHashMap_fixed: public cc::feldman_hashmap::traits
+        {
+            typedef map::cmp<Key>    compare;
+        };
+
+        typedef FeldmanHashMap< cds::gc::HP, Key, Value,  traits_FeldmanHashMap_fixed >    FeldmanHashMap_hp_fixed;
+        typedef FeldmanHashMap< cds::gc::DHP, Key, Value, traits_FeldmanHashMap_fixed >   FeldmanHashMap_dhp_fixed;
+        typedef FeldmanHashMap< rcu_gpi, Key, Value,      traits_FeldmanHashMap_fixed >    FeldmanHashMap_rcu_gpi_fixed;
+        typedef FeldmanHashMap< rcu_gpb, Key, Value,      traits_FeldmanHashMap_fixed >    FeldmanHashMap_rcu_gpb_fixed;
+        typedef FeldmanHashMap< rcu_gpt, Key, Value,      traits_FeldmanHashMap_fixed >    FeldmanHashMap_rcu_gpt_fixed;
 #ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
 #ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
-        typedef FeldmanHashMap< rcu_shb, Key, Value >    FeldmanHashMap_rcu_shb_fixed;
-        typedef FeldmanHashMap< rcu_sht, Key, Value >    FeldmanHashMap_rcu_sht_fixed;
+        typedef FeldmanHashMap< rcu_shb, Key, Value,      traits_FeldmanHashMap_fixed >    FeldmanHashMap_rcu_shb_fixed;
+        typedef FeldmanHashMap< rcu_sht, Key, Value,      traits_FeldmanHashMap_fixed >    FeldmanHashMap_rcu_sht_fixed;
 #endif
 
 #endif
 
-        struct traits_FeldmanHashMap_stat : public cc::feldman_hashmap::traits
+        struct traits_FeldmanHashMap_fixed_stat : public traits_FeldmanHashMap_fixed
         {
             typedef cc::feldman_hashmap::stat<> stat;
         };
         {
             typedef cc::feldman_hashmap::stat<> stat;
         };
-        typedef FeldmanHashMap< cds::gc::HP, Key, Value, traits_FeldmanHashMap_stat >    FeldmanHashMap_hp_fixed_stat;
-        typedef FeldmanHashMap< cds::gc::DHP, Key, Value, traits_FeldmanHashMap_stat >   FeldmanHashMap_dhp_fixed_stat;
-        typedef FeldmanHashMap< rcu_gpi, Key, Value, traits_FeldmanHashMap_stat >    FeldmanHashMap_rcu_gpi_fixed_stat;
-        typedef FeldmanHashMap< rcu_gpb, Key, Value, traits_FeldmanHashMap_stat >    FeldmanHashMap_rcu_gpb_fixed_stat;
-        typedef FeldmanHashMap< rcu_gpt, Key, Value, traits_FeldmanHashMap_stat >    FeldmanHashMap_rcu_gpt_fixed_stat;
+        typedef FeldmanHashMap< cds::gc::HP, Key, Value,    traits_FeldmanHashMap_fixed_stat >  FeldmanHashMap_hp_fixed_stat;
+        typedef FeldmanHashMap< cds::gc::DHP, Key, Value,   traits_FeldmanHashMap_fixed_stat >  FeldmanHashMap_dhp_fixed_stat;
+        typedef FeldmanHashMap< rcu_gpi, Key, Value,        traits_FeldmanHashMap_fixed_stat >  FeldmanHashMap_rcu_gpi_fixed_stat;
+        typedef FeldmanHashMap< rcu_gpb, Key, Value,        traits_FeldmanHashMap_fixed_stat >  FeldmanHashMap_rcu_gpb_fixed_stat;
+        typedef FeldmanHashMap< rcu_gpt, Key, Value,        traits_FeldmanHashMap_fixed_stat >  FeldmanHashMap_rcu_gpt_fixed_stat;
 #ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
 #ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
-        typedef FeldmanHashMap< rcu_shb, Key, Value, traits_FeldmanHashMap_stat >    FeldmanHashMap_rcu_shb_fixed_stat;
-        typedef FeldmanHashMap< rcu_sht, Key, Value, traits_FeldmanHashMap_stat >    FeldmanHashMap_rcu_sht_fixed_stat;
+        typedef FeldmanHashMap< rcu_shb, Key, Value, traits_FeldmanHashMap_fixed_stat > FeldmanHashMap_rcu_shb_fixed_stat;
+        typedef FeldmanHashMap< rcu_sht, Key, Value, traits_FeldmanHashMap_fixed_stat > FeldmanHashMap_rcu_sht_fixed_stat;
 #endif
 
     };
 #endif
 
     };