-
Notifications
You must be signed in to change notification settings - Fork 13.1k
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
std::min and std::max should require TotalOrd
#12712
Comments
Having methods min and max on integers and floating point seems to broad. I like changing to TotalOrd better. Can work on it if we have enough people agreeing with the change. |
There are now If they're going to be switched to |
+1 to that plan. |
The `Float` trait provides correct `min` and `max` methods on floating point types, providing a consistent result regardless of the order the parameters are passed. These generic functions do not take the necessary performance hit to correctly support a partial order, so the true requirement should be given as a type bound. Closes #12712
…ykril fix: ignore renames for crate root close rust-lang#12684 . I just ignore renames for crate root in `rename_mod` func.
These do not handle partial orderings correctly. #12509 adds correct
min
andmax
methods to theFloat
trait to be used in place of these. These will likely end up as LLVM intrinsics at some point in the future too.This can be fixed either by making the functions require
TotalOrd
, or by making them default methods onOrd
and doing an override for floating point types.The text was updated successfully, but these errors were encountered: