This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: RE : Problem with _Hashtable_ebo_helper


On 28 October 2013 21:26, Jonathan Wakely wrote:
>
> If what we want is a type that derives from __hash_code_base in order
> to check if that dervide type would be default constructible then we
> should create a new type that does that, not appropriate
> _Hashtable_ebo_helper for something it isn't designed for, and after
> your fix doesn't even work for!

Like so:

diff --git a/libstdc++-v3/include/bits/hashtable.h
b/libstdc++-v3/include/bits/hashtable.h
index c639c55..aae146b 100644
--- a/libstdc++-v3/include/bits/hashtable.h
+++ b/libstdc++-v3/include/bits/hashtable.h
@@ -277,14 +277,15 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
                    "Functor used to map hash code to bucket index"
                    " must be default constructible");

+      // _Hash_code_base has a protected default constructor, so use this
+      // derived type to tell if it's usable.
+      struct __access_protected_ctor : __hash_code_base { };
+
       // When hash codes are not cached local iterator inherits from
       // __hash_code_base above to compute node bucket index so it has to be
       // default constructible.
       static_assert(__if_hash_not_cached<
-                   is_default_constructible<
-                     // We use _Hashtable_ebo_helper to access the protected
-                     // default constructor.
-                     __detail::_Hashtable_ebo_helper<0,
__hash_code_base, true>>>::value,
+                   is_default_constructible<__access_protected_ctor>>::value,
                    "Cache the hash code or make functors involved in hash code"
                    " and bucket index computation default constructible");


I'll test this.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]