General Purpose library for Freestanding C++ and POSIX systems
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
 
 

29 行
568 B

#pragma once
namespace gp{
template<typename T, typename U, typename ...rest>
constexpr T max(T first, U second, rest... args)
{
if constexpr (sizeof...(args) == 0)
{
return first > second ? first : second;
}
else
{
return max(first > second ? first : second, args...);
}
}
template<typename T, typename U, typename ...rest>
constexpr T min(T first, U second, rest... args)
{
if constexpr (sizeof...(args) == 0)
{
return first < second ? first : second;
}
else
{
return min(first < second ? first : second, args...);
}
}
}