maths: add maxmin query

This commit is contained in:
Danny Robson 2019-03-20 16:07:30 +11:00
parent 065daa96c6
commit 89a4641c33

View File

@ -645,6 +645,19 @@ namespace cruft {
min (std::array<ValueT,CountV> &&) = delete;
///------------------------------------------------------------------------
/// Returns an ordered pair where the elements come from the parameters.
template <typename ValueT>
std::pair<ValueT,ValueT>
maxmin (ValueT a, ValueT b)
{
if (a >= b)
return { a, b };
else
return { b, a };
}
///////////////////////////////////////////////////////////////////////////
// Limiting functions