template<class T> constexpr const T& clamp(const T& v, const T& lo, const T& hi); template<class T, class Compare> constexpr const T& clamp(const T& v, const T& lo, const T& hi, Compare comp);
Requires: The value of lo shall be no greater than hi. For the first form, type T shall be LessThanComparable.
Returns: lo if v is less than lo, hi if hi is less than v, otherwise v.
[ Note: If NaN is avoided, T can be a floating-point type. — end note ]
Complexity: At most two comparisons.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4