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

PrevUpHomeNext

Function template is_clamped

boost::algorithm::is_clamped

Synopsis

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


template<typename T, typename Pred> 
  BOOST_CXX14_CONSTEXPR bool 
  is_clamped(T const & val, 
             typename boost::type_identity< T >::type const & lo, 
             typename boost::type_identity< T >::type const & hi, Pred p);

Description

Parameters:

hi

The upper bound of the range

lo

The lower bound of the range

p

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

val

The value to be checked

Returns:

true if value "val" is in the range [ lo, hi ] using the comparison predicate p. If p ( val, lo ) return false. If p ( hi, val ) return false. Otherwise, returns true.


PrevUpHomeNext