Fixed tests and gcc incompatibilities
authorkhizmax <libcds.dev@gmail.com>
Sun, 13 Nov 2016 18:13:30 +0000 (21:13 +0300)
committerkhizmax <libcds.dev@gmail.com>
Sun, 13 Nov 2016 18:13:30 +0000 (21:13 +0300)
cds/algo/split_bitstring.h
cds/container/details/feldman_hashmap_base.h
test/unit/intrusive-set/test_intrusive_feldman_hashset_rcu.h
test/unit/misc/split_bitstring.cpp
test/unit/set/test_feldman_hashset_rcu.h

index f74d4ea7aabd5f992a38d663f6f1aa043f0735cc..d290ff77ecb7f69e556a3a99cea083462c3ae110 100644 (file)
@@ -46,7 +46,8 @@ namespace cds { namespace algo {
 
         Template parameters:
         - \p BitString - a fixed-sized type that interprets as bit string
-        - \p BitStringSize - the siZe of \p BitString in bytes, default is <tt>sizeof( BitString )</tt>
+        - \p BitStringSize - the size of \p BitString in bytes, default is <tt>sizeof( BitString )</tt>.
+             You can specify 0 for default.
         - \p UInt - an unsigned integer, return type of \p cut()
     */
     template <typename BitString, size_t BitStringSize = sizeof( BitString ), typename UInt = typename std::conditional< BitStringSize % sizeof(size_t) == 0, size_t, unsigned >::type >
@@ -55,7 +56,7 @@ namespace cds { namespace algo {
     public:
         typedef BitString bitstring;    ///< Bit-string type
         typedef UInt      uint_type;    ///< Bit-string portion type
-        static CDS_CONSTEXPR size_t const c_bitstring_size = BitStringSize; ///< size of \p BitString in bytes
+        static CDS_CONSTEXPR size_t const c_bitstring_size = BitStringSize ? BitStringSize : sizeof( BitString ); ///< size of \p BitString in bytes
 
         //@cond
         static CDS_CONSTEXPR size_t const c_nHashSize   = (c_bitstring_size + sizeof(uint_type) - 1) / sizeof(uint_type);
index 9535cb5f8a74a3a1175669090769d7e19fd42894..995414a2443942e92c4feb9533f4bbeb29404e2d 100644 (file)
@@ -275,20 +275,20 @@ namespace cds { namespace container {
 
                 template <typename Q>
                 node_type(hasher& h, Q const& key)
-                    : m_Value(std::move(std::make_pair(key, mapped_type())))
-                    , m_hash(h(m_Value.first))
+                    : m_Value( std::move( std::make_pair( key_type( key ), mapped_type())))
+                    , m_hash( h( m_Value.first ))
                 {}
 
                 template <typename Q, typename U >
                 node_type(hasher& h, Q const& key, U const& val)
-                    : m_Value(std::move(std::make_pair(key, mapped_type(val))))
-                    , m_hash(h(m_Value.first))
+                    : m_Value( std::move( std::make_pair( key_type( key ), mapped_type(val))))
+                    , m_hash( h( m_Value.first ))
                 {}
 
                 template <typename Q, typename... Args>
                 node_type(hasher& h, Q&& key, Args&&... args)
-                    : m_Value(std::move(std::make_pair(std::forward<Q>(key), std::move(mapped_type(std::forward<Args>(args)...)))))
-                    , m_hash(h(m_Value.first))
+                    : m_Value( std::move(std::make_pair( key_type( std::forward<Q>(key)), std::move( mapped_type(std::forward<Args>(args)...)))))
+                    , m_hash( h( m_Value.first ))
                 {}
             };
 
index 3f9436328c8c172f9b01f50cb1f296d6cf5912ad..6099a8e796b252837265e1097ebb928735b27c0f 100644 (file)
@@ -229,7 +229,7 @@ TYPED_TEST_P( IntrusiveFeldmanHashSet, explicit_hash_size )
     {
         typedef typename TestFixture::hash_accessor2 hash_accessor;
         enum: size_t {
-            hash_size = sizeof( std::declval<key_val>().nKey )
+            hash_size = sizeof( std::declval<typename TestFixture::key_val>().nKey )
         };
         typedef typename TestFixture::cmp2 compare;
         typedef typename TestFixture::mock_disposer disposer;
index 27f7dc0c40dd11038077eacf67fc524f7f92c003..69e5842ca446b65cfd2b70751b19734f13712792 100644 (file)
@@ -195,7 +195,7 @@ namespace {
         {
             typedef PartUInt part_uint;
 
-            typedef cds::algo::split_bitstring< uint64_t, part_uint > split_bitstring;
+            typedef cds::algo::split_bitstring< uint64_t, 0, part_uint > split_bitstring;
 
             uint64_t src = 0xFEDCBA9876543210;
             split_bitstring splitter(src);
@@ -250,7 +250,7 @@ namespace {
         {
             typedef PartUInt part_uint;
 
-            typedef cds::algo::split_bitstring< uint64_t, part_uint > split_bitstring;
+            typedef cds::algo::split_bitstring< uint64_t, 0, part_uint > split_bitstring;
 
             uint64_t src = 0xFEDCBA9876543210;
             split_bitstring splitter(src);
index e7016faefe8e531331de6e48f1aa5133f13a581e..85b6161d58cbb9561e3f832d1e8366be205b9769 100644 (file)
@@ -289,12 +289,13 @@ namespace {
         struct set_traits: public cc::feldman_hashset::traits
         {
             enum: size_t {
-                hash_size = sizeof( std::declval<int_item2>().nKey )
+                hash_size = sizeof( std::declval<int_item>().nKey )
             };
             typedef get_hash2 hash_accessor;
+            typedef typename TestFixture::cmp2 compare;
             typedef cc::feldman_hashset::stat<> stat;
         };
-        typedef cc::FeldmanHashSet< rcu_type, int_item2, set_traits > set_type;
+        typedef cc::FeldmanHashSet< rcu_type, int_item, set_traits > set_type;
 
         set_type s( 8, 4 );
         this->test( s );