rcpputils
master
C++ API providing common utilities and data structures.
|
Restrict a value between two bounds. More...
#include <cassert>
Go to the source code of this file.
Namespaces | |
rcppmath | |
Functions | |
template<class T > | |
constexpr const T & | rcppmath::clamp (const T &v, const T &lo, const T &hi) |
If v compares less than lo, returns lo; otherwise if hi compares less. More... | |
template<class T , class Compare > | |
constexpr const T & | rcppmath::clamp (const T &v, const T &lo, const T &hi, Compare comp) |
Like the function above, but uses comp to compare the values. More... | |
Restrict a value between two bounds.