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 to view this page for the latest version.
PrevUpHomeNext

Header <boost/algorithm/clamp.hpp>

Clamp algorithm.

Marshall Clow

Suggested by olafvdspek in https://svn.boost.org/trac/boost/ticket/3215

namespace boost {
  namespace algorithm {
    template<typename T, typename Pred> 
      BOOST_CXX14_CONSTEXPR T const & 
      clamp(T const &, typename boost::mpl::identity< T >::type const &, 
            typename boost::mpl::identity< T >::type const &, Pred);
    template<typename T> 
      BOOST_CXX14_CONSTEXPR T const & 
      clamp(const T &, typename boost::mpl::identity< T >::type const &, 
            typename boost::mpl::identity< T >::type const &);
    template<typename InputIterator, typename OutputIterator> 
      BOOST_CXX14_CONSTEXPR OutputIterator 
      clamp_range(InputIterator first, InputIterator last, OutputIterator out, 
                  typename std::iterator_traits< InputIterator >::value_type const & lo, 
                  typename std::iterator_traits< InputIterator >::value_type const & hi);
    template<typename Range, typename OutputIterator> 
      BOOST_CXX14_CONSTEXPR boost::disable_if_c< boost::is_same< Range, OutputIterator >::value, OutputIterator >::type 
      clamp_range(const Range &, OutputIterator, 
                  typename std::iterator_traits< typename boost::range_iterator< const Range >::type >::value_type const &, 
                  typename std::iterator_traits< typename boost::range_iterator< const Range >::type >::value_type const &);
    template<typename InputIterator, typename OutputIterator, typename Pred> 
      BOOST_CXX14_CONSTEXPR OutputIterator 
      clamp_range(InputIterator first, InputIterator last, OutputIterator out, 
                  typename std::iterator_traits< InputIterator >::value_type const & lo, 
                  typename std::iterator_traits< InputIterator >::value_type const & hi, 
                  Pred p);
    template<typename Range, typename OutputIterator, typename Pred> 
      BOOST_CXX14_CONSTEXPR boost::disable_if_c< boost::is_same< Range, OutputIterator >::value, OutputIterator >::type 
      clamp_range(const Range &, OutputIterator, 
                  typename std::iterator_traits< typename boost::range_iterator< const Range >::type >::value_type const &, 
                  typename std::iterator_traits< typename boost::range_iterator< const Range >::type >::value_type const &, 
                  Pred);
  }
}

PrevUpHomeNext