I have wrote a utility named nostd::clip
that clips a provided value x
between a floor
and a ceiling
:
namespace nostd {
template<class T>
auto clip(T floor, T x, T ceiling) -> T
{
return std::min(ceiling, std::max(floor, x));
}
}
Is there some function in std
that does the same thing, that I could replace this with? Maybe in C++17?