Added a recursive max function
This commit is contained in:
parent
65f172a02e
commit
bc567c5e7b
1 changed files with 12 additions and 0 deletions
|
|
@ -35,6 +35,18 @@
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
#include <random>
|
#include <random>
|
||||||
|
|
||||||
|
template<class T>
|
||||||
|
constexpr T max(T op1, T op2)
|
||||||
|
{
|
||||||
|
return std::max(op1, op2);
|
||||||
|
}
|
||||||
|
|
||||||
|
template<class T, class... Args>
|
||||||
|
constexpr T max(T op1, Args... rest)
|
||||||
|
{
|
||||||
|
return std::max(op1, max(rest...));
|
||||||
|
}
|
||||||
|
|
||||||
template<class T>
|
template<class T>
|
||||||
constexpr T min(T op1, T op2)
|
constexpr T min(T op1, T op2)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue