diff options
Diffstat (limited to 'absl/hash/internal')
-rw-r--r-- | absl/hash/internal/hash.h | 19 | ||||
-rw-r--r-- | absl/hash/internal/spy_hash_state.h | 2 |
2 files changed, 3 insertions, 18 deletions
diff --git a/absl/hash/internal/hash.h b/absl/hash/internal/hash.h index 6c00f35413d1..ba6d7468e1b8 100644 --- a/absl/hash/internal/hash.h +++ b/absl/hash/internal/hash.h @@ -541,17 +541,8 @@ hash_range_or_bytes(H hash_state, const T* data, size_t size) { // * If is_uniquely_represented, hash bytes directly. // * ADL AbslHashValue(H, const T&) call. // * std::hash<T> - -// In MSVC we can't probe std::hash or stdext::hash because it triggers a -// static_assert instead of failing substitution. -#if defined(_MSC_VER) -#define ABSL_HASH_INTERNAL_CAN_POISON_ 0 -#else // _MSC_VER -#define ABSL_HASH_INTERNAL_CAN_POISON_ 1 -#endif // _MSC_VER - #if defined(ABSL_INTERNAL_LEGACY_HASH_NAMESPACE) && \ - ABSL_HASH_INTERNAL_CAN_POISON_ + ABSL_META_INTERNAL_STD_HASH_SFINAE_FRIENDLY_ #define ABSL_HASH_INTERNAL_SUPPORT_LEGACY_HASH_ 1 #else #define ABSL_HASH_INTERNAL_SUPPORT_LEGACY_HASH_ 0 @@ -616,13 +607,7 @@ struct HashSelect { #endif // ABSL_HASH_INTERNAL_SUPPORT_LEGACY_HASH_ template <typename U> - using ProbeStdHash = -#if ABSL_HASH_INTERNAL_CAN_POISON_ - std::is_convertible<decltype(std::hash<U>()(std::declval<const U&>())), - size_t>; -#else // ABSL_HASH_INTERNAL_CAN_POISON_ - std::true_type; -#endif // ABSL_HASH_INTERNAL_CAN_POISON_ + using ProbeStdHash = absl::type_traits_internal::IsHashable<U>; template <typename U> using ProbeNone = std::true_type; diff --git a/absl/hash/internal/spy_hash_state.h b/absl/hash/internal/spy_hash_state.h index 03d795b09001..e7d1dfef37ee 100644 --- a/absl/hash/internal/spy_hash_state.h +++ b/absl/hash/internal/spy_hash_state.h @@ -200,7 +200,7 @@ bool RunOnStartup<f>::run = (f(), true); template < typename T, typename U, // Only trigger for when (T != U), - absl::enable_if_t<!std::is_same<T, U>::value, int> = 0, + typename = absl::enable_if_t<!std::is_same<T, U>::value>, // This statement works in two ways: // - First, it instantiates RunOnStartup and forces the initialization of // `run`, which set the global variable. |