Problem with _Hashtable_ebo_helper
Jonathan Wakely
jwakely.gcc@gmail.com
Mon Oct 28 21:36:00 GMT 2013
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.
More information about the Libstdc++
mailing list