Skip to content

Instantly share code, notes, and snippets.

Last active April 13, 2020 14:27
What would you like to do?
template <typename T, typename U>
struct pair {
T first;
U second;
constexpr std::strong_ordering operator<=>(const pair& other) const {
if (auto first_comp = first <=> other.first; first_comp != 0) {
return first_comp;
} else {
return second <=> other.second;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment