base: define is_std_hash_enabled type trait

Change-Id: I7ffb7f80a90006d6b8cd42bdf3d63e34c6dbda01
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/71839
Reviewed-by: Bobby Bruce <bbruce@ucdavis.edu>
Tested-by: kokoro <noreply+kokoro@google.com>
Maintainer: Bobby Bruce <bbruce@ucdavis.edu>
This commit is contained in:
Gabriel Busnot
2023-06-20 19:10:49 +00:00
committed by Gabriel B.
parent 2f327fa2b8
commit 5282fac317

View File

@@ -105,6 +105,17 @@ struct is_iterable<T,
template <typename T>
constexpr bool is_iterable_v = is_iterable<T>::value;
// std::hash-enabled type trait
template <typename, typename = void>
struct is_std_hash_enabled: std::false_type {};
template <typename T>
struct is_std_hash_enabled<T,
std::void_t<decltype(std::hash<T>())>>: std::true_type {};
template <typename T>
constexpr bool is_std_hash_enabled_v = is_std_hash_enabled<T>::value;
} // namespace gem5
#endif // BASE_TYPETRAITS_HH