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 Range, typename OutputIterator, typename Pred> 
  boost::disable_if_c< boost::is_same< Range, OutputIterator >::value, OutputIterator >::type 
  clamp_range(const Range & r, OutputIterator out, 
              typename std::iterator_traits< typename boost::range_iterator< const Range >::type >::value_type lo, 
              typename std::iterator_traits< typename boost::range_iterator< const Range >::type >::value_type hi, 
              Pred p);

Description

Parameters:

hi

The upper bound of the range to be clamped to

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.

r

The range of values to be clamped

Returns:

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


PrevUpHomeNext