-
Notifications
You must be signed in to change notification settings - Fork 407
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
clamp(v, lo, hi) changed slightly in C++20. Should we change as well? #6966
Comments
I agree. We should use |
|
And to be consistent, we'd add all six comparator functors, both as a primary template as well as clang is functionally equivalent to what we do now. gcc does more work because of unusual architectures it supports, but I'm not sure that is applicable for us. I guess I'm asking: is this worth doing (presumably following the gcc model)? |
In C++17,
clamp(v, lo, hi)
usesoperator<
to do the comparison.In C++20 and beyond,
clamp(v, lo, hi)
usesstd::less{}
to do the comparison. I'm not sure why it changed (I cannot find the LWG issue), but I suspect this has something to do with clamping pointers.Should we change, and if so, should that change be dependent on the C++ version?
My answer to the above is yes and no.
The text was updated successfully, but these errors were encountered: