[PATCH] D136850: [ADT] Simplify hashing for tuples
Joe Loser via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Oct 27 12:46:38 PDT 2022
This revision was automatically updated to reflect the committed changes.
Closed by commit rG8d35558527ba: [ADT] Simplify hashing for tuples (authored by jloser).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D136850/new/
https://reviews.llvm.org/D136850
Files:
llvm/include/llvm/ADT/Hashing.h
Index: llvm/include/llvm/ADT/Hashing.h
===================================================================
--- llvm/include/llvm/ADT/Hashing.h
+++ llvm/include/llvm/ADT/Hashing.h
@@ -651,24 +651,8 @@
return hash_combine(arg.first, arg.second);
}
-// Implementation details for the hash_value overload for std::tuple<...>(...).
-namespace hashing {
-namespace detail {
-
-template <typename... Ts, std::size_t... Indices>
-hash_code hash_value_tuple_helper(const std::tuple<Ts...> &arg,
- std::index_sequence<Indices...>) {
- return hash_combine(std::get<Indices>(arg)...);
-}
-
-} // namespace detail
-} // namespace hashing
-
-template <typename... Ts>
-hash_code hash_value(const std::tuple<Ts...> &arg) {
- // TODO: Use std::apply when LLVM starts using C++17.
- return ::llvm::hashing::detail::hash_value_tuple_helper(
- arg, typename std::index_sequence_for<Ts...>());
+template <typename... Ts> hash_code hash_value(const std::tuple<Ts...> &arg) {
+ return std::apply([](const auto &...xs) { return hash_combine(xs...); }, arg);
}
// Declared and documented above, but defined here so that any of the hashing
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D136850.471264.patch
Type: text/x-patch
Size: 1167 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20221027/f6dab7a7/attachment.bin>
More information about the llvm-commits
mailing list