rubenvb
rubenvb

Reputation: 76529

Is there a std::less/std::greater for the spaceship operator?

All the basic comparisons (<, <=, ==, !=, >=, >) have an associated function object (std::less, std::less_equal, std::equal_to, std::not_equal_to, std::greater_equal, std::greater).

Does the spaceship operator <=> have a similar function object? If not, why was it not added to the standard library?

Upvotes: 22

Views: 1227

Answers (1)

Yksisarvinen
Yksisarvinen

Reputation: 22219

std::compare_three_way is the function object for three-way comparison (aka. spaceship operator).

Upvotes: 24

Related Questions