C++ Logo

std-proposals

Advanced search

[std-proposals] Comparison operators between pair<T, U> and tuple<T, U>

From: Kilian Henneberger <kilis-mail_at_[hidden]>
Date: Fri, 29 Apr 2022 17:09:52 +0200
Hello everyone,

has anyone proposed additions to std::pair/std::tuple for C++26 yet? 😛
While writing unit tests for zip_view and zip_transform_view, I realized
that you could not compare a pair<T, U> with a tuple<T, U>.
What is your opinion about adding comparison operators between pair<T,
U> and tuple<T, U>?
Something like:

template <class T, class U>
constexpr bool operator==(const pair<T, U>& lhs, const tuple<T, U>& rhs);

template <class T, class U>
constexpr /*some comparison category*/ operator<=>(const pair<T, U>&
lhs, const tuple<T, U>& rhs);

Best regards,
Kilian

Received on 2022-04-29 15:09:52