diff options
author | Benjamin Kramer <benny.kra@googlemail.com> | 2023-01-25 01:38:28 +0100 |
---|---|---|
committer | Benjamin Kramer <benny.kra@googlemail.com> | 2023-01-25 01:42:17 +0100 |
commit | 388b8c16c5610a54c639bb74e3c8de161e8ca1c6 (patch) | |
tree | 8bcf28d6f2b70d2b4ba9a9863c9e2e11864fff08 | |
parent | f05731434589284116cbf79be7c5571af9558405 (diff) | |
download | llvm-388b8c16c5610a54c639bb74e3c8de161e8ca1c6.tar.gz |
[ADT] Use fold expressions to compare tuples. NFCI
-rw-r--r-- | llvm/include/llvm/ADT/STLExtras.h | 18 |
1 files changed, 6 insertions, 12 deletions
diff --git a/llvm/include/llvm/ADT/STLExtras.h b/llvm/include/llvm/ADT/STLExtras.h index f6a1bd89bbe8..79b145632d5a 100644 --- a/llvm/include/llvm/ADT/STLExtras.h +++ b/llvm/include/llvm/ADT/STLExtras.h @@ -26,7 +26,6 @@ #include "llvm/Config/abi-breaking.h" #include "llvm/Support/ErrorHandling.h" #include <algorithm> -#include <array> #include <cassert> #include <cstddef> #include <cstdint> @@ -787,9 +786,8 @@ protected: template <size_t... Ns> bool test_all_equals(const zip_common &other, std::index_sequence<Ns...>) const { - return all_of(std::initializer_list<bool>{std::get<Ns>(this->iterators) == - std::get<Ns>(other.iterators)...}, - identity<bool>{}); + return ((std::get<Ns>(this->iterators) == std::get<Ns>(other.iterators)) && + ...); } public: @@ -833,10 +831,8 @@ class zip_shortest : public zip_common<zip_shortest<Iters...>, Iters...> { template <size_t... Ns> bool test(const zip_shortest<Iters...> &other, std::index_sequence<Ns...>) const { - return all_of( - std::array<bool, sizeof...(Ns)>({std::get<Ns>(this->iterators) != - std::get<Ns>(other.iterators)...}), - identity<bool>{}); + return ((std::get<Ns>(this->iterators) != std::get<Ns>(other.iterators)) && + ...); } public: @@ -966,10 +962,8 @@ private: template <size_t... Ns> bool test(const zip_longest_iterator<Iters...> &other, std::index_sequence<Ns...>) const { - return llvm::any_of( - std::initializer_list<bool>{std::get<Ns>(this->iterators) != - std::get<Ns>(other.iterators)...}, - identity<bool>{}); + return ((std::get<Ns>(this->iterators) != std::get<Ns>(other.iterators)) || + ...); } template <size_t... Ns> value_type deref(std::index_sequence<Ns...>) const { |