Last active
April 13, 2020 14:27
-
-
Save danlark1/42618dcdcd81894cc0805076a93af055 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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