tetl 0.1.0
Embedded Template Library
Loading...
Searching...
No Matches
clamp.hpp File Reference

Go to the source code of this file.

Namespaces

namespace  etl
 

Functions

template<typename Type>
constexpr auto clamp (Type const &v, Type const &lo, Type const &hi) noexcept -> Type const &
 If v compares less than lo, returns lo; otherwise if hi compares less than v, returns hi; otherwise returns v. Uses operator< to compare the values.
 
template<typename Type, typename Compare>
constexpr auto clamp (Type const &v, Type const &lo, Type const &hi, Compare comp) -> Type const &
 If v compares less than lo, returns lo; otherwise if hi compares less than v, returns hi; otherwise returns v. Uses operator< to compare the values.