Open In App

boost::algorithm::clamp() in C++ library

The clamp() function in C++ boost library is found under the header ‘boost/algorithm/clamp.hpp’ contains two functions for “clamping” a value between a pair of boundary values.

Syntax:



const T& clamp ( const T& val, const T& lo, const T& hi )
or 
const T& clamp ( const T& value, const T& low, const T& high, Pred p )

Parameters: The function accepts parameters as described below:

Article Tags :
C++