diff --git a/llvm/include/llvm/ADT/STLExtras.h b/llvm/include/llvm/ADT/STLExtras.h --- a/llvm/include/llvm/ADT/STLExtras.h +++ b/llvm/include/llvm/ADT/STLExtras.h @@ -26,6 +26,7 @@ #include "llvm/Config/abi-breaking.h" #include "llvm/Support/ErrorHandling.h" #include +#include #include #include #include @@ -827,32 +828,28 @@ }; template -struct zip_first : public zip_common, Iters...> { - using Base = zip_common, Iters...>; +struct zip_first : zip_common, Iters...> { + using zip_common::zip_common; - bool operator==(const zip_first &other) const { + bool operator==(const zip_first &other) const { return std::get<0>(this->iterators) == std::get<0>(other.iterators); } - - zip_first(Iters &&... ts) : Base(std::forward(ts)...) {} }; template -class zip_shortest : public zip_common, Iters...> { - template - bool test(const zip_shortest &other, - std::index_sequence) const { - return ((std::get(this->iterators) != std::get(other.iterators)) && - ...); - } - -public: - using Base = zip_common, Iters...>; +struct zip_shortest : zip_common, Iters...> { + using zip_common::zip_common; - zip_shortest(Iters &&... ts) : Base(std::forward(ts)...) {} + bool operator==(const zip_shortest &other) const { + return any_iterator_equals(other, std::index_sequence_for{}); + } - bool operator==(const zip_shortest &other) const { - return !test(other, std::index_sequence_for{}); +private: + template + bool any_iterator_equals(const zip_shortest &other, + std::index_sequence) const { + return ((std::get(this->iterators) == std::get(other.iterators)) || + ...); } };