Skip to content

Commit 388b8c1

Browse files
committed
[ADT] Use fold expressions to compare tuples. NFCI
1 parent f057314 commit 388b8c1

File tree

1 file changed

+6
-12
lines changed

1 file changed

+6
-12
lines changed

llvm/include/llvm/ADT/STLExtras.h

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626
#include "llvm/Config/abi-breaking.h"
2727
#include "llvm/Support/ErrorHandling.h"
2828
#include <algorithm>
29-
#include <array>
3029
#include <cassert>
3130
#include <cstddef>
3231
#include <cstdint>
@@ -787,9 +786,8 @@ struct zip_common : public zip_traits<ZipType, Iters...> {
787786
template <size_t... Ns>
788787
bool test_all_equals(const zip_common &other,
789788
std::index_sequence<Ns...>) const {
790-
return all_of(std::initializer_list<bool>{std::get<Ns>(this->iterators) ==
791-
std::get<Ns>(other.iterators)...},
792-
identity<bool>{});
789+
return ((std::get<Ns>(this->iterators) == std::get<Ns>(other.iterators)) &&
790+
...);
793791
}
794792

795793
public:
@@ -833,10 +831,8 @@ class zip_shortest : public zip_common<zip_shortest<Iters...>, Iters...> {
833831
template <size_t... Ns>
834832
bool test(const zip_shortest<Iters...> &other,
835833
std::index_sequence<Ns...>) const {
836-
return all_of(
837-
std::array<bool, sizeof...(Ns)>({std::get<Ns>(this->iterators) !=
838-
std::get<Ns>(other.iterators)...}),
839-
identity<bool>{});
834+
return ((std::get<Ns>(this->iterators) != std::get<Ns>(other.iterators)) &&
835+
...);
840836
}
841837

842838
public:
@@ -966,10 +962,8 @@ class zip_longest_iterator
966962
template <size_t... Ns>
967963
bool test(const zip_longest_iterator<Iters...> &other,
968964
std::index_sequence<Ns...>) const {
969-
return llvm::any_of(
970-
std::initializer_list<bool>{std::get<Ns>(this->iterators) !=
971-
std::get<Ns>(other.iterators)...},
972-
identity<bool>{});
965+
return ((std::get<Ns>(this->iterators) != std::get<Ns>(other.iterators)) ||
966+
...);
973967
}
974968

975969
template <size_t... Ns> value_type deref(std::index_sequence<Ns...>) const {

0 commit comments

Comments
 (0)