maths: allow min to operate on multiple types
This commit is contained in:
parent
62f11a87dc
commit
5e1aad2f15
@ -23,6 +23,7 @@
|
|||||||
#include "annotations.hpp"
|
#include "annotations.hpp"
|
||||||
|
|
||||||
#include <type_traits>
|
#include <type_traits>
|
||||||
|
#include <utility>
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
constexpr T
|
constexpr T
|
||||||
@ -151,9 +152,9 @@ min (const T &a)
|
|||||||
{ return a; }
|
{ return a; }
|
||||||
|
|
||||||
|
|
||||||
template <typename T, typename ...Args>
|
template <typename T, typename U, typename ...Args>
|
||||||
const T&
|
typename std::common_type<T, U>::type
|
||||||
min (const T &a , const T &b , const Args &...args )
|
min (const T a , const U b , const Args &...args )
|
||||||
{ return min ( b < a ? b : a, args...); }
|
{ return min ( b < a ? b : a, args...); }
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user