[libcxx-commits] [libcxx] [libc++][modules] Refactor poisoned_hash_helper (PR #108296)
Nikolas Klauser via libcxx-commits
libcxx-commits at lists.llvm.org
Thu Sep 12 04:46:44 PDT 2024
================
@@ -205,41 +116,59 @@ void test_hash_disabled() {
static_assert(!can_hash<Hash, ConvertibleTo<Key> const&&>(), "");
}
+enum Enum {};
+enum EnumClass : bool {};
+struct Class {};
-template <class First, class ...Rest>
-struct TypeList<First, Rest...> {
- template <template <class> class Trait, bool Expect = true>
- static constexpr bool assertTrait() {
- static_assert(Trait<First>::value == Expect, "");
- return TypeList<Rest...>::template assertTrait<Trait, Expect>();
- }
-
- template <class Trait>
- static void applyTrait() {
- Trait::template apply<First>();
- TypeList<Rest...>::template applyTrait<Trait>();
- }
-};
-
-template <>
-struct TypeList<> {
- template <template <class> class Trait, bool Expect = true>
- static constexpr bool assertTrait() {
- return true;
+// Each header that declares the std::hash template provides enabled
+// specializations of std::hash for std::nullptr_t and all cv-unqualified
+// arithmetic, enumeration, and pointer types.
+using LibraryHashTypes = types::type_list<
+#if TEST_STD_VER > 14
+ decltype(nullptr),
+#endif
+ bool,
+ char,
+ signed char,
+ unsigned char,
+#ifndef TEST_HAS_NO_WIDE_CHARACTERS
+ wchar_t,
+#endif
+ char16_t,
+ char32_t,
+ short,
+ unsigned short,
+ int,
+ unsigned int,
+ long,
+ unsigned long,
+ long long,
+ unsigned long long,
+#ifndef TEST_HAS_NO_INT128
+ __int128_t,
+ __uint128_t,
+#endif
+ float,
+ double,
+ long double,
+ Enum,
+ EnumClass,
+ void*,
+ void const*,
+ Class*>;
----------------
philnik777 wrote:
```suggestion
using LibraryHashTypes = types::concatenate_t<
types::arithmetic_types,
type::type_list<
#if TEST_STD_VER > 14
decltype(nullptr),
#endif
Enum,
EnumClass,
void*,
void const*,
Class*> >;
```
https://github.com/llvm/llvm-project/pull/108296
More information about the libcxx-commits
mailing list