Closed tcbrindle closed 1 year ago
Patch coverage: 100.00%
and no project coverage change.
Comparison is base (
e83bdcb
) 97.58% compared to head (44a3078
) 97.58%. Report is 2 commits behind head on main.
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
Because they're ordinary function templates,
std::min
andstd::max
can't be passed as arguments to functions without wrapping them in lambdas (or doing a horrible function pointer cast). This makes me sad.std::ranges::min
andstd::ranges::max
are function objects and so can be passed as function arguments -- except with MSVC, which annoyingly goes out of its way to prevent you doing this very useful thing. This also makes me sad.To improve matters, we'll add
flux::cmp::min
andflux::cmp::max
which take two arguments and an optional comparator and return the lesser and greater respectively.As an added bonus,
max()
now correctly returns the second argument if both are equal, and our versions of these functions should be less likely than the standard versions to cause dangling when used with rvalues.