Boost C++ Libraries

...one of the most highly regarded and expertly designed C++ library projects in the world. Herb Sutter and Andrei Alexandrescu, C++ Coding Standards

This is the documentation for an old version of boost. Click here for the latest Boost documentation.
PrevUpHomeNext

Function template clamp_range

boost::algorithm::clamp_range

Synopsis

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


template<typename InputIterator, typename OutputIterator, typename Pred> 
  OutputIterator 
  clamp_range(InputIterator first, InputIterator last, OutputIterator out, 
              typename std::iterator_traits< InputIterator >::value_type lo, 
              typename std::iterator_traits< InputIterator >::value_type hi, 
              Pred p);

Description

Parameters:

first

The start of the range of values

hi

The upper bound of the range to be clamped to

last

One past the end of the range of input values

lo

The lower bound of the range to be clamped to

out

An output iterator to write the clamped values into

p

A predicate to use to compare the values. p ( a, b ) returns a boolean.

Returns:

clamp the sequence of values [first, last) into [ lo, hi ] using the comparison predicate p.


PrevUpHomeNext