maths: allow min to operate on multiple types

This commit is contained in:
Danny Robson 2014-08-02 21:13:31 +10:00
parent 62f11a87dc
commit 5e1aad2f15

View File

@ -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...); }