| Home | Libraries | People | FAQ | More

## Function template clamp

boost::algorithm::clamp

## Synopsis

    // In header: <boost/algorithm/clamp.hpp>

    template<typename T>
      T const & clamp(const T & val,
                      typename boost::mpl::identity< T >::type const & lo,
                      typename boost::mpl::identity< T >::type const & hi);

## Description

Parameters: |
`hi` | The upper bound of the range to be clamped to
`lo` | The lower bound of the range to be clamped to
`val` | The value to be clamped
Returns: | the value "val" brought into the range [ lo, hi ]. If the value is less than lo, return lo. If the value is greater than "hi", return hi. Otherwise, return the original value.