NoSenseEtAl
NoSenseEtAl

Reputation: 30118

Why std::clamp changed how comparison is done in C++20?

There is interesting note on C++ reference for first overload of std::clamp(one that does not take custom comparator).

Uses operator< (until C++20) std::less<> (since C++20) to compare the values.

All I found on cppreference is this (about std::less), but that seems borderline useless motivation since "most" (all) implementations know how to compare pointers.

A specialization of std::less for any pointer type yields the implementation-defined strict total order, even if the built-in < operator does not.

Upvotes: 2

Views: 545

Answers (1)

Barry
Barry

Reputation: 303507

This is just a wording clarification, it doesn't change any of the meaning of the algorithm.

Upvotes: 1

Related Questions