diff --git a/llvm/include/llvm/ADT/STLExtras.h b/llvm/include/llvm/ADT/STLExtras.h index 0ee260bc99f23..74fbfc958beac 100644 --- a/llvm/include/llvm/ADT/STLExtras.h +++ b/llvm/include/llvm/ADT/STLExtras.h @@ -827,32 +827,28 @@ struct zip_common : public zip_traits { }; 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)) || + ...); } };