Search code examples
c++c++20function-objectspaceship-operator

What is the equivalent of std::less for the three-way comparison operator?


Does C++20 define something similar to std::less for three-way comparison operator (<=>).

I would like define some datasructure with customizable comparator as map or unordered_map do.

template <class DefaultComparison = std::??????<Key>,
struct MyContainer ... 

Solution

  • std::compare_three_way is what you are looking for.