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 <type_traits>
#include <utility>
template <typename T>
constexpr T
@ -151,9 +152,9 @@ min (const T &a)
{ return a; }
template <typename T, typename ...Args>
const T&
min (const T &a , const T &b , const Args &...args )
template <typename T, typename U, typename ...Args>
typename std::common_type<T, U>::type
min (const T a , const U b , const Args &...args )
{ return min ( b < a ? b : a, args...); }