diff --git a/maths.hpp b/maths.hpp index adc7dc47..83ef32d1 100644 --- a/maths.hpp +++ b/maths.hpp @@ -645,6 +645,19 @@ namespace cruft { min (std::array &&) = delete; + ///------------------------------------------------------------------------ + /// Returns an ordered pair where the elements come from the parameters. + template + std::pair + maxmin (ValueT a, ValueT b) + { + if (a >= b) + return { a, b }; + else + return { b, a }; + } + + /////////////////////////////////////////////////////////////////////////// // Limiting functions