forked from boostorg/algorithm
		
	Catch up with the changes; apply_permutation; constexpr, etc
This commit is contained in:
		@@ -25,10 +25,10 @@
 | 
			
		||||
namespace boost { namespace algorithm {
 | 
			
		||||
 | 
			
		||||
template <typename T>
 | 
			
		||||
T identity_operation ( std::multiplies<T> ) { return T(1); }
 | 
			
		||||
BOOST_CXX14_CONSTEXPR T identity_operation ( std::multiplies<T> ) { return T(1); }
 | 
			
		||||
 | 
			
		||||
template <typename T>
 | 
			
		||||
T identity_operation ( std::plus<T> ) { return T(0); }
 | 
			
		||||
BOOST_CXX14_CONSTEXPR T identity_operation ( std::plus<T> ) { return T(0); }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
/// \fn power ( T x, Integer n )
 | 
			
		||||
@@ -40,7 +40,7 @@ T identity_operation ( std::plus<T> ) { return T(0); }
 | 
			
		||||
//  \remark Taken from Knuth, The Art of Computer Programming, Volume 2:
 | 
			
		||||
//  Seminumerical Algorithms, Section 4.6.3
 | 
			
		||||
template <typename T, typename Integer>
 | 
			
		||||
typename boost::enable_if<boost::is_integral<Integer>, T>::type
 | 
			
		||||
BOOST_CXX14_CONSTEXPR typename boost::enable_if<boost::is_integral<Integer>, T>::type
 | 
			
		||||
power (T x, Integer n) {
 | 
			
		||||
    T y = 1; // Should be "T y{1};" 
 | 
			
		||||
    if (n == 0) return y;
 | 
			
		||||
@@ -67,7 +67,7 @@ power (T x, Integer n) {
 | 
			
		||||
//  \remark Taken from Knuth, The Art of Computer Programming, Volume 2:
 | 
			
		||||
//  Seminumerical Algorithms, Section 4.6.3
 | 
			
		||||
template <typename T, typename Integer, typename Operation>
 | 
			
		||||
typename boost::enable_if<boost::is_integral<Integer>, T>::type
 | 
			
		||||
BOOST_CXX14_CONSTEXPR typename boost::enable_if<boost::is_integral<Integer>, T>::type
 | 
			
		||||
power (T x, Integer n, Operation op) {
 | 
			
		||||
    T y = identity_operation(op);
 | 
			
		||||
    if (n == 0) return y;
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										125
									
								
								include/boost/algorithm/apply_permutation.hpp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										125
									
								
								include/boost/algorithm/apply_permutation.hpp
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,125 @@
 | 
			
		||||
/*
 | 
			
		||||
  Copyright (c) Alexander Zaitsev <zamazan4ik@gmail.com>, 2017
 | 
			
		||||
 | 
			
		||||
  Distributed under the Boost Software License, Version 1.0. (See
 | 
			
		||||
  accompanying file LICENSE_1_0.txt or copy at
 | 
			
		||||
  http://www.boost.org/LICENSE_1_0.txt)
 | 
			
		||||
 | 
			
		||||
  See http://www.boost.org/ for latest version.
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
  Based on https://blogs.msdn.microsoft.com/oldnewthing/20170104-00/?p=95115
 | 
			
		||||
*/
 | 
			
		||||
 | 
			
		||||
/// \file  apply_permutation.hpp
 | 
			
		||||
/// \brief Apply permutation to a sequence.
 | 
			
		||||
/// \author Alexander Zaitsev
 | 
			
		||||
 | 
			
		||||
#ifndef BOOST_ALGORITHM_APPLY_PERMUTATION_HPP
 | 
			
		||||
#define BOOST_ALGORITHM_APPLY_PERMUTATION_HPP
 | 
			
		||||
 | 
			
		||||
#include <algorithm>
 | 
			
		||||
#include <type_traits>
 | 
			
		||||
 | 
			
		||||
#include <boost/range/begin.hpp>
 | 
			
		||||
#include <boost/range/end.hpp>
 | 
			
		||||
 | 
			
		||||
namespace boost { namespace algorithm
 | 
			
		||||
{
 | 
			
		||||
 | 
			
		||||
/// \fn apply_permutation ( RandomAccessIterator1 item_begin, RandomAccessIterator1 item_end, RandomAccessIterator2 ind_begin )
 | 
			
		||||
/// \brief Reorder item sequence with index sequence order
 | 
			
		||||
///
 | 
			
		||||
/// \param item_begin    The start of the item sequence
 | 
			
		||||
/// \param item_end		 One past the end of the item sequence
 | 
			
		||||
/// \param ind_begin     The start of the index sequence.
 | 
			
		||||
///
 | 
			
		||||
/// \note Item sequence size should be equal to index size. Otherwise behavior is undefined.
 | 
			
		||||
///       Complexity: O(N).
 | 
			
		||||
template<typename RandomAccessIterator1, typename RandomAccessIterator2>
 | 
			
		||||
void
 | 
			
		||||
apply_permutation(RandomAccessIterator1 item_begin, RandomAccessIterator1 item_end,
 | 
			
		||||
                  RandomAccessIterator2 ind_begin, RandomAccessIterator2 ind_end)
 | 
			
		||||
{
 | 
			
		||||
    using Diff = typename std::iterator_traits<RandomAccessIterator1>::difference_type;
 | 
			
		||||
    using std::swap;
 | 
			
		||||
    Diff size = std::distance(item_begin, item_end);
 | 
			
		||||
    for (Diff i = 0; i < size; i++)
 | 
			
		||||
    {
 | 
			
		||||
        auto current = i;
 | 
			
		||||
        while (i != ind_begin[current])
 | 
			
		||||
        {
 | 
			
		||||
            auto next = ind_begin[current];
 | 
			
		||||
            swap(item_begin[current], item_begin[next]);
 | 
			
		||||
            ind_begin[current] = current;
 | 
			
		||||
            current = next;
 | 
			
		||||
        }
 | 
			
		||||
        ind_begin[current] = current;
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/// \fn apply_reverse_permutation ( RandomAccessIterator1 item_begin, RandomAccessIterator1 item_end, RandomAccessIterator2 ind_begin )
 | 
			
		||||
/// \brief Reorder item sequence with index sequence order
 | 
			
		||||
///
 | 
			
		||||
/// \param item_begin    The start of the item sequence
 | 
			
		||||
/// \param item_end		 One past the end of the item sequence
 | 
			
		||||
/// \param ind_begin     The start of the index sequence.
 | 
			
		||||
///
 | 
			
		||||
/// \note Item sequence size should be equal to index size. Otherwise behavior is undefined.
 | 
			
		||||
///       Complexity: O(N).
 | 
			
		||||
template<typename RandomAccessIterator1, typename RandomAccessIterator2>
 | 
			
		||||
void
 | 
			
		||||
apply_reverse_permutation(
 | 
			
		||||
        RandomAccessIterator1 item_begin,
 | 
			
		||||
        RandomAccessIterator1 item_end,
 | 
			
		||||
        RandomAccessIterator2 ind_begin,
 | 
			
		||||
        RandomAccessIterator2 ind_end)
 | 
			
		||||
{
 | 
			
		||||
    using Diff = typename std::iterator_traits<RandomAccessIterator2>::difference_type;
 | 
			
		||||
    using std::swap;
 | 
			
		||||
    Diff length = std::distance(item_begin, item_end);
 | 
			
		||||
    for (Diff i = 0; i < length; i++)
 | 
			
		||||
    {
 | 
			
		||||
        while (i != ind_begin[i])
 | 
			
		||||
        {
 | 
			
		||||
            Diff next = ind_begin[i];
 | 
			
		||||
            swap(item_begin[i], item_begin[next]);
 | 
			
		||||
            swap(ind_begin[i], ind_begin[next]);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/// \fn apply_permutation ( Range1 item_range, Range2 ind_range )
 | 
			
		||||
/// \brief Reorder item sequence with index sequence order
 | 
			
		||||
///
 | 
			
		||||
/// \param item_range    The item sequence
 | 
			
		||||
/// \param ind_range     The index sequence
 | 
			
		||||
///
 | 
			
		||||
/// \note Item sequence size should be equal to index size. Otherwise behavior is undefined.
 | 
			
		||||
///       Complexity: O(N).
 | 
			
		||||
template<typename Range1, typename Range2>
 | 
			
		||||
void
 | 
			
		||||
apply_permutation(Range1& item_range, Range2& ind_range)
 | 
			
		||||
{
 | 
			
		||||
    apply_permutation(boost::begin(item_range), boost::end(item_range),
 | 
			
		||||
                      boost::begin(ind_range), boost::end(ind_range));
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/// \fn apply_reverse_permutation ( Range1 item_range, Range2 ind_range )
 | 
			
		||||
/// \brief Reorder item sequence with index sequence order
 | 
			
		||||
///
 | 
			
		||||
/// \param item_range    The item sequence
 | 
			
		||||
/// \param ind_range     The index sequence
 | 
			
		||||
///
 | 
			
		||||
/// \note Item sequence size should be equal to index size. Otherwise behavior is undefined.
 | 
			
		||||
///       Complexity: O(N).
 | 
			
		||||
template<typename Range1, typename Range2>
 | 
			
		||||
void
 | 
			
		||||
apply_reverse_permutation(Range1& item_range, Range2& ind_range)
 | 
			
		||||
{
 | 
			
		||||
    apply_reverse_permutation(boost::begin(item_range), boost::end(item_range),
 | 
			
		||||
                              boost::begin(ind_range), boost::end(ind_range));
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
}}
 | 
			
		||||
#endif //BOOST_ALGORITHM_APPLY_PERMUTATION_HPP
 | 
			
		||||
@@ -46,7 +46,7 @@ namespace boost { namespace algorithm {
 | 
			
		||||
///                 p ( a, b ) returns a boolean.
 | 
			
		||||
///
 | 
			
		||||
  template<typename T, typename Pred> 
 | 
			
		||||
  T const & clamp ( T const& val, 
 | 
			
		||||
  BOOST_CXX14_CONSTEXPR T const & clamp ( T const& val, 
 | 
			
		||||
    typename boost::mpl::identity<T>::type const & lo, 
 | 
			
		||||
    typename boost::mpl::identity<T>::type const & hi, Pred p )
 | 
			
		||||
  {
 | 
			
		||||
@@ -68,11 +68,11 @@ namespace boost { namespace algorithm {
 | 
			
		||||
/// \param hi    The upper bound of the range to be clamped to
 | 
			
		||||
///
 | 
			
		||||
  template<typename T> 
 | 
			
		||||
  T const& clamp ( const T& val, 
 | 
			
		||||
  BOOST_CXX14_CONSTEXPR T const& clamp ( const T& val, 
 | 
			
		||||
    typename boost::mpl::identity<T>::type const & lo, 
 | 
			
		||||
    typename boost::mpl::identity<T>::type const & hi )
 | 
			
		||||
  {
 | 
			
		||||
    return (clamp) ( val, lo, hi, std::less<T>());
 | 
			
		||||
    return boost::algorithm::clamp ( val, lo, hi, std::less<T>());
 | 
			
		||||
  } 
 | 
			
		||||
 | 
			
		||||
/// \fn clamp_range ( InputIterator first, InputIterator last, OutputIterator out, 
 | 
			
		||||
@@ -87,13 +87,13 @@ namespace boost { namespace algorithm {
 | 
			
		||||
/// \param hi    The upper bound of the range to be clamped to
 | 
			
		||||
///
 | 
			
		||||
  template<typename InputIterator, typename OutputIterator> 
 | 
			
		||||
  OutputIterator clamp_range ( InputIterator first, InputIterator last, OutputIterator out,
 | 
			
		||||
  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 )
 | 
			
		||||
  {
 | 
			
		||||
  // this could also be written with bind and std::transform
 | 
			
		||||
    while ( first != last )
 | 
			
		||||
        *out++ = clamp ( *first++, lo, hi );
 | 
			
		||||
        *out++ = boost::algorithm::clamp ( *first++, lo, hi );
 | 
			
		||||
    return out;
 | 
			
		||||
  } 
 | 
			
		||||
 | 
			
		||||
@@ -108,12 +108,12 @@ namespace boost { namespace algorithm {
 | 
			
		||||
/// \param hi    The upper bound of the range to be clamped to
 | 
			
		||||
///
 | 
			
		||||
  template<typename Range, typename OutputIterator> 
 | 
			
		||||
  typename boost::disable_if_c<boost::is_same<Range, OutputIterator>::value, OutputIterator>::type
 | 
			
		||||
  BOOST_CXX14_CONSTEXPR typename 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 const & lo, 
 | 
			
		||||
    typename std::iterator_traits<typename boost::range_iterator<const Range>::type>::value_type const & hi )
 | 
			
		||||
  {
 | 
			
		||||
    return clamp_range ( boost::begin ( r ), boost::end ( r ), out, lo, hi );
 | 
			
		||||
    return boost::algorithm::clamp_range ( boost::begin ( r ), boost::end ( r ), out, lo, hi );
 | 
			
		||||
  } 
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@@ -133,13 +133,13 @@ namespace boost { namespace algorithm {
 | 
			
		||||
 | 
			
		||||
///
 | 
			
		||||
  template<typename InputIterator, typename OutputIterator, typename Pred> 
 | 
			
		||||
  OutputIterator clamp_range ( InputIterator first, InputIterator last, OutputIterator out,
 | 
			
		||||
  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 )
 | 
			
		||||
  {
 | 
			
		||||
  // this could also be written with bind and std::transform
 | 
			
		||||
    while ( first != last )
 | 
			
		||||
        *out++ = clamp ( *first++, lo, hi, p );
 | 
			
		||||
        *out++ = boost::algorithm::clamp ( *first++, lo, hi, p );
 | 
			
		||||
    return out;
 | 
			
		||||
  } 
 | 
			
		||||
 | 
			
		||||
@@ -160,13 +160,13 @@ namespace boost { namespace algorithm {
 | 
			
		||||
//  Disable this template if the first two parameters are the same type;
 | 
			
		||||
//  In that case, the user will get the two iterator version.
 | 
			
		||||
  template<typename Range, typename OutputIterator, typename Pred> 
 | 
			
		||||
  typename boost::disable_if_c<boost::is_same<Range, OutputIterator>::value, OutputIterator>::type
 | 
			
		||||
  BOOST_CXX14_CONSTEXPR typename 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 const & lo, 
 | 
			
		||||
    typename std::iterator_traits<typename boost::range_iterator<const Range>::type>::value_type const & hi,
 | 
			
		||||
    Pred p )
 | 
			
		||||
  {
 | 
			
		||||
    return clamp_range ( boost::begin ( r ), boost::end ( r ), out, lo, hi, p );
 | 
			
		||||
    return boost::algorithm::clamp_range ( boost::begin ( r ), boost::end ( r ), out, lo, hi, p );
 | 
			
		||||
  } 
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -27,7 +27,7 @@ namespace boost { namespace algorithm {
 | 
			
		||||
///
 | 
			
		||||
/// \note           This function is part of the C++2011 standard library.
 | 
			
		||||
template<typename InputIterator, typename Predicate> 
 | 
			
		||||
bool all_of ( InputIterator first, InputIterator last, Predicate p )
 | 
			
		||||
BOOST_CXX14_CONSTEXPR bool all_of ( InputIterator first, InputIterator last, Predicate p )
 | 
			
		||||
{
 | 
			
		||||
    for ( ; first != last; ++first )
 | 
			
		||||
        if ( !p(*first)) 
 | 
			
		||||
@@ -43,7 +43,7 @@ bool all_of ( InputIterator first, InputIterator last, Predicate p )
 | 
			
		||||
/// \param p    A predicate for testing the elements of the range
 | 
			
		||||
///
 | 
			
		||||
template<typename Range, typename Predicate> 
 | 
			
		||||
bool all_of ( const Range &r, Predicate p )
 | 
			
		||||
BOOST_CXX14_CONSTEXPR bool all_of ( const Range &r, Predicate p )
 | 
			
		||||
{
 | 
			
		||||
    return boost::algorithm::all_of ( boost::begin (r), boost::end (r), p );
 | 
			
		||||
} 
 | 
			
		||||
@@ -57,7 +57,7 @@ bool all_of ( const Range &r, Predicate p )
 | 
			
		||||
/// \param val   A value to compare against
 | 
			
		||||
///
 | 
			
		||||
template<typename InputIterator, typename T> 
 | 
			
		||||
bool all_of_equal ( InputIterator first, InputIterator last, const T &val )
 | 
			
		||||
BOOST_CXX14_CONSTEXPR bool all_of_equal ( InputIterator first, InputIterator last, const T &val )
 | 
			
		||||
{
 | 
			
		||||
    for ( ; first != last; ++first )
 | 
			
		||||
    if ( val != *first ) 
 | 
			
		||||
@@ -73,7 +73,7 @@ bool all_of_equal ( InputIterator first, InputIterator last, const T &val )
 | 
			
		||||
/// \param val  A value to compare against
 | 
			
		||||
///
 | 
			
		||||
template<typename Range, typename T> 
 | 
			
		||||
bool all_of_equal ( const Range &r, const T &val ) 
 | 
			
		||||
BOOST_CXX14_CONSTEXPR bool all_of_equal ( const Range &r, const T &val ) 
 | 
			
		||||
{
 | 
			
		||||
    return boost::algorithm::all_of_equal ( boost::begin (r), boost::end (r), val );
 | 
			
		||||
} 
 | 
			
		||||
 
 | 
			
		||||
@@ -28,7 +28,7 @@ namespace boost { namespace algorithm {
 | 
			
		||||
/// \param p     A predicate for testing the elements of the sequence
 | 
			
		||||
///
 | 
			
		||||
template<typename InputIterator, typename Predicate> 
 | 
			
		||||
bool any_of ( InputIterator first, InputIterator last, Predicate p ) 
 | 
			
		||||
BOOST_CXX14_CONSTEXPR bool any_of ( InputIterator first, InputIterator last, Predicate p ) 
 | 
			
		||||
{
 | 
			
		||||
    for ( ; first != last; ++first )
 | 
			
		||||
        if ( p(*first)) 
 | 
			
		||||
@@ -44,7 +44,7 @@ bool any_of ( InputIterator first, InputIterator last, Predicate p )
 | 
			
		||||
/// \param p    A predicate for testing the elements of the range
 | 
			
		||||
///
 | 
			
		||||
template<typename Range, typename Predicate> 
 | 
			
		||||
bool any_of ( const Range &r, Predicate p )
 | 
			
		||||
BOOST_CXX14_CONSTEXPR bool any_of ( const Range &r, Predicate p )
 | 
			
		||||
{
 | 
			
		||||
    return boost::algorithm::any_of (boost::begin (r), boost::end (r), p);
 | 
			
		||||
} 
 | 
			
		||||
@@ -58,7 +58,7 @@ bool any_of ( const Range &r, Predicate p )
 | 
			
		||||
/// \param val   A value to compare against
 | 
			
		||||
///
 | 
			
		||||
template<typename InputIterator, typename V> 
 | 
			
		||||
bool any_of_equal ( InputIterator first, InputIterator last, const V &val ) 
 | 
			
		||||
BOOST_CXX14_CONSTEXPR bool any_of_equal ( InputIterator first, InputIterator last, const V &val ) 
 | 
			
		||||
{
 | 
			
		||||
    for ( ; first != last; ++first )
 | 
			
		||||
        if ( val == *first )
 | 
			
		||||
@@ -74,7 +74,7 @@ bool any_of_equal ( InputIterator first, InputIterator last, const V &val )
 | 
			
		||||
/// \param val   A value to compare against
 | 
			
		||||
///
 | 
			
		||||
template<typename Range, typename V> 
 | 
			
		||||
bool any_of_equal ( const Range &r, const V &val ) 
 | 
			
		||||
BOOST_CXX14_CONSTEXPR bool any_of_equal ( const Range &r, const V &val ) 
 | 
			
		||||
{
 | 
			
		||||
    return boost::algorithm::any_of_equal (boost::begin (r), boost::end (r), val);
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -29,7 +29,7 @@ namespace boost { namespace algorithm {
 | 
			
		||||
/// \param p        A predicate for testing the elements of the range
 | 
			
		||||
/// \note           This function is part of the C++2011 standard library.
 | 
			
		||||
template<typename InputIterator, typename OutputIterator, typename Predicate> 
 | 
			
		||||
OutputIterator copy_if ( InputIterator first, InputIterator last, OutputIterator result, Predicate p )
 | 
			
		||||
BOOST_CXX14_CONSTEXPR OutputIterator copy_if ( InputIterator first, InputIterator last, OutputIterator result, Predicate p )
 | 
			
		||||
{
 | 
			
		||||
    for ( ; first != last; ++first )
 | 
			
		||||
        if (p(*first))
 | 
			
		||||
@@ -47,7 +47,7 @@ OutputIterator copy_if ( InputIterator first, InputIterator last, OutputIterator
 | 
			
		||||
/// \param p        A predicate for testing the elements of the range
 | 
			
		||||
///
 | 
			
		||||
template<typename Range, typename OutputIterator, typename Predicate>
 | 
			
		||||
OutputIterator copy_if ( const Range &r, OutputIterator result, Predicate p )
 | 
			
		||||
BOOST_CXX14_CONSTEXPR OutputIterator copy_if ( const Range &r, OutputIterator result, Predicate p )
 | 
			
		||||
{
 | 
			
		||||
    return boost::algorithm::copy_if (boost::begin (r), boost::end(r), result, p);
 | 
			
		||||
}
 | 
			
		||||
@@ -64,7 +64,7 @@ OutputIterator copy_if ( const Range &r, OutputIterator result, Predicate p )
 | 
			
		||||
/// \param p        A predicate for testing the elements of the range
 | 
			
		||||
///
 | 
			
		||||
template<typename InputIterator, typename OutputIterator, typename Predicate> 
 | 
			
		||||
std::pair<InputIterator, OutputIterator>
 | 
			
		||||
BOOST_CXX14_CONSTEXPR std::pair<InputIterator, OutputIterator>
 | 
			
		||||
copy_while ( InputIterator first, InputIterator last, OutputIterator result, Predicate p )
 | 
			
		||||
{
 | 
			
		||||
    for ( ; first != last && p(*first); ++first )
 | 
			
		||||
@@ -82,7 +82,7 @@ copy_while ( InputIterator first, InputIterator last, OutputIterator result, Pre
 | 
			
		||||
/// \param p        A predicate for testing the elements of the range
 | 
			
		||||
///
 | 
			
		||||
template<typename Range, typename OutputIterator, typename Predicate>
 | 
			
		||||
std::pair<typename boost::range_iterator<const Range>::type, OutputIterator> 
 | 
			
		||||
BOOST_CXX14_CONSTEXPR std::pair<typename boost::range_iterator<const Range>::type, OutputIterator> 
 | 
			
		||||
copy_while ( const Range &r, OutputIterator result, Predicate p )
 | 
			
		||||
{
 | 
			
		||||
    return boost::algorithm::copy_while (boost::begin (r), boost::end(r), result, p);
 | 
			
		||||
@@ -100,7 +100,7 @@ copy_while ( const Range &r, OutputIterator result, Predicate p )
 | 
			
		||||
/// \param p        A predicate for testing the elements of the range
 | 
			
		||||
///
 | 
			
		||||
template<typename InputIterator, typename OutputIterator, typename Predicate> 
 | 
			
		||||
std::pair<InputIterator, OutputIterator>
 | 
			
		||||
BOOST_CXX14_CONSTEXPR std::pair<InputIterator, OutputIterator>
 | 
			
		||||
copy_until ( InputIterator first, InputIterator last, OutputIterator result, Predicate p )
 | 
			
		||||
{
 | 
			
		||||
    for ( ; first != last && !p(*first); ++first )
 | 
			
		||||
@@ -118,7 +118,7 @@ copy_until ( InputIterator first, InputIterator last, OutputIterator result, Pre
 | 
			
		||||
/// \param p        A predicate for testing the elements of the range
 | 
			
		||||
///
 | 
			
		||||
template<typename Range, typename OutputIterator, typename Predicate>
 | 
			
		||||
std::pair<typename boost::range_iterator<const Range>::type, OutputIterator> 
 | 
			
		||||
BOOST_CXX14_CONSTEXPR std::pair<typename boost::range_iterator<const Range>::type, OutputIterator> 
 | 
			
		||||
copy_until ( const Range &r, OutputIterator result, Predicate p )
 | 
			
		||||
{
 | 
			
		||||
    return boost::algorithm::copy_until (boost::begin (r), boost::end(r), result, p);
 | 
			
		||||
 
 | 
			
		||||
@@ -24,7 +24,7 @@ namespace boost { namespace algorithm {
 | 
			
		||||
/// \param result   An output iterator to write the results into
 | 
			
		||||
/// \note           This function is part of the C++2011 standard library.
 | 
			
		||||
template <typename InputIterator, typename Size, typename OutputIterator>
 | 
			
		||||
OutputIterator copy_n ( InputIterator first, Size n, OutputIterator result )
 | 
			
		||||
BOOST_CXX14_CONSTEXPR OutputIterator copy_n ( InputIterator first, Size n, OutputIterator result )
 | 
			
		||||
{
 | 
			
		||||
    for ( ; n > 0; --n, ++first, ++result )
 | 
			
		||||
        *result = *first;
 | 
			
		||||
 
 | 
			
		||||
@@ -26,7 +26,7 @@ namespace boost { namespace algorithm {
 | 
			
		||||
/// \param p        A predicate for testing the elements of the range
 | 
			
		||||
/// \note           This function is part of the C++2011 standard library.
 | 
			
		||||
template<typename InputIterator, typename Predicate> 
 | 
			
		||||
InputIterator find_if_not ( InputIterator first, InputIterator last, Predicate p )
 | 
			
		||||
BOOST_CXX14_CONSTEXPR InputIterator find_if_not ( InputIterator first, InputIterator last, Predicate p )
 | 
			
		||||
{
 | 
			
		||||
    for ( ; first != last; ++first )
 | 
			
		||||
        if ( !p(*first))
 | 
			
		||||
@@ -42,7 +42,7 @@ InputIterator find_if_not ( InputIterator first, InputIterator last, Predicate p
 | 
			
		||||
/// \param p        A predicate for testing the elements of the range
 | 
			
		||||
///
 | 
			
		||||
template<typename Range, typename Predicate>
 | 
			
		||||
typename boost::range_iterator<const Range>::type find_if_not ( const Range &r, Predicate p )
 | 
			
		||||
BOOST_CXX14_CONSTEXPR typename boost::range_iterator<const Range>::type find_if_not ( const Range &r, Predicate p )
 | 
			
		||||
{
 | 
			
		||||
    return boost::algorithm::find_if_not (boost::begin (r), boost::end(r), p);
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -25,7 +25,7 @@ namespace boost { namespace algorithm {
 | 
			
		||||
/// \param value    The initial value of the sequence to be generated
 | 
			
		||||
/// \note           This function is part of the C++2011 standard library.
 | 
			
		||||
template <typename ForwardIterator, typename T>
 | 
			
		||||
void iota ( ForwardIterator first, ForwardIterator last, T value )
 | 
			
		||||
BOOST_CXX14_CONSTEXPR void iota ( ForwardIterator first, ForwardIterator last, T value )
 | 
			
		||||
{
 | 
			
		||||
    for ( ; first != last; ++first, ++value )
 | 
			
		||||
        *first = value;
 | 
			
		||||
@@ -38,7 +38,7 @@ void iota ( ForwardIterator first, ForwardIterator last, T value )
 | 
			
		||||
/// \param value    The initial value of the sequence to be generated
 | 
			
		||||
///
 | 
			
		||||
template <typename Range, typename T>
 | 
			
		||||
void iota ( Range &r, T value )
 | 
			
		||||
BOOST_CXX14_CONSTEXPR void iota ( Range &r, T value )
 | 
			
		||||
{
 | 
			
		||||
    boost::algorithm::iota (boost::begin(r), boost::end(r), value);
 | 
			
		||||
}
 | 
			
		||||
@@ -52,7 +52,7 @@ void iota ( Range &r, T value )
 | 
			
		||||
/// \param n        The number of items to write
 | 
			
		||||
///
 | 
			
		||||
template <typename OutputIterator, typename T>
 | 
			
		||||
OutputIterator iota_n ( OutputIterator out, T value, std::size_t n )
 | 
			
		||||
BOOST_CXX14_CONSTEXPR OutputIterator iota_n ( OutputIterator out, T value, std::size_t n )
 | 
			
		||||
{
 | 
			
		||||
    for ( ; n > 0; --n, ++value )
 | 
			
		||||
        *out++ = value;
 | 
			
		||||
 
 | 
			
		||||
@@ -26,7 +26,7 @@ namespace boost { namespace algorithm {
 | 
			
		||||
/// \param p        The predicate to test the values with
 | 
			
		||||
/// \note           This function is part of the C++2011 standard library.
 | 
			
		||||
template <typename InputIterator, typename UnaryPredicate>
 | 
			
		||||
bool is_partitioned ( InputIterator first, InputIterator last, UnaryPredicate p )
 | 
			
		||||
BOOST_CXX14_CONSTEXPR bool is_partitioned ( InputIterator first, InputIterator last, UnaryPredicate p )
 | 
			
		||||
{
 | 
			
		||||
//  Run through the part that satisfy the predicate
 | 
			
		||||
    for ( ; first != last; ++first )
 | 
			
		||||
@@ -47,7 +47,7 @@ bool is_partitioned ( InputIterator first, InputIterator last, UnaryPredicate p
 | 
			
		||||
/// \param p        The predicate to test the values with
 | 
			
		||||
///
 | 
			
		||||
template <typename Range, typename UnaryPredicate>
 | 
			
		||||
bool is_partitioned ( const Range &r, UnaryPredicate p )
 | 
			
		||||
BOOST_CXX14_CONSTEXPR bool is_partitioned ( const Range &r, UnaryPredicate p )
 | 
			
		||||
{
 | 
			
		||||
    return boost::algorithm::is_partitioned (boost::begin(r), boost::end(r), p);
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -34,7 +34,7 @@ namespace boost { namespace algorithm {
 | 
			
		||||
/// \param p     A binary predicate that returns true if two elements are ordered.
 | 
			
		||||
///
 | 
			
		||||
    template <typename ForwardIterator, typename Pred>
 | 
			
		||||
    ForwardIterator is_sorted_until ( ForwardIterator first, ForwardIterator last, Pred p )
 | 
			
		||||
    BOOST_CXX14_CONSTEXPR ForwardIterator is_sorted_until ( ForwardIterator first, ForwardIterator last, Pred p )
 | 
			
		||||
    {
 | 
			
		||||
        if ( first == last ) return last;  // the empty sequence is ordered
 | 
			
		||||
        ForwardIterator next = first;
 | 
			
		||||
@@ -54,7 +54,7 @@ namespace boost { namespace algorithm {
 | 
			
		||||
/// \param last  One past the end of the sequence
 | 
			
		||||
///
 | 
			
		||||
    template <typename ForwardIterator>
 | 
			
		||||
    ForwardIterator is_sorted_until ( ForwardIterator first, ForwardIterator last )
 | 
			
		||||
    BOOST_CXX14_CONSTEXPR ForwardIterator is_sorted_until ( ForwardIterator first, ForwardIterator last )
 | 
			
		||||
    {
 | 
			
		||||
        typedef typename std::iterator_traits<ForwardIterator>::value_type value_type;
 | 
			
		||||
        return boost::algorithm::is_sorted_until ( first, last, std::less<value_type>());
 | 
			
		||||
@@ -69,7 +69,7 @@ namespace boost { namespace algorithm {
 | 
			
		||||
/// \param p     A binary predicate that returns true if two elements are ordered.
 | 
			
		||||
///
 | 
			
		||||
    template <typename ForwardIterator, typename Pred>
 | 
			
		||||
    bool is_sorted ( ForwardIterator first, ForwardIterator last, Pred p )
 | 
			
		||||
    BOOST_CXX14_CONSTEXPR bool is_sorted ( ForwardIterator first, ForwardIterator last, Pred p )
 | 
			
		||||
    {
 | 
			
		||||
        return boost::algorithm::is_sorted_until (first, last, p) == last;
 | 
			
		||||
    }
 | 
			
		||||
@@ -81,7 +81,7 @@ namespace boost { namespace algorithm {
 | 
			
		||||
/// \param last  One past the end of the sequence
 | 
			
		||||
///
 | 
			
		||||
    template <typename ForwardIterator>
 | 
			
		||||
    bool is_sorted ( ForwardIterator first, ForwardIterator last )
 | 
			
		||||
    BOOST_CXX14_CONSTEXPR bool is_sorted ( ForwardIterator first, ForwardIterator last )
 | 
			
		||||
    {
 | 
			
		||||
        return boost::algorithm::is_sorted_until (first, last) == last;
 | 
			
		||||
    }
 | 
			
		||||
@@ -98,7 +98,7 @@ namespace boost { namespace algorithm {
 | 
			
		||||
/// \param p     A binary predicate that returns true if two elements are ordered.
 | 
			
		||||
///
 | 
			
		||||
    template <typename R, typename Pred>
 | 
			
		||||
    typename boost::lazy_disable_if_c<
 | 
			
		||||
    BOOST_CXX14_CONSTEXPR typename boost::lazy_disable_if_c<
 | 
			
		||||
        boost::is_same<R, Pred>::value, 
 | 
			
		||||
        typename boost::range_iterator<const R> 
 | 
			
		||||
    >::type is_sorted_until ( const R &range, Pred p )
 | 
			
		||||
@@ -113,7 +113,7 @@ namespace boost { namespace algorithm {
 | 
			
		||||
/// \param range The range to be tested.
 | 
			
		||||
///
 | 
			
		||||
    template <typename R>
 | 
			
		||||
    typename boost::range_iterator<const R>::type is_sorted_until ( const R &range )
 | 
			
		||||
    BOOST_CXX14_CONSTEXPR typename boost::range_iterator<const R>::type is_sorted_until ( const R &range )
 | 
			
		||||
    {
 | 
			
		||||
        return boost::algorithm::is_sorted_until ( boost::begin ( range ), boost::end ( range ));
 | 
			
		||||
    }
 | 
			
		||||
@@ -126,7 +126,7 @@ namespace boost { namespace algorithm {
 | 
			
		||||
/// \param p     A binary predicate that returns true if two elements are ordered.
 | 
			
		||||
///
 | 
			
		||||
    template <typename R, typename Pred>
 | 
			
		||||
    typename boost::lazy_disable_if_c< boost::is_same<R, Pred>::value, boost::mpl::identity<bool> >::type
 | 
			
		||||
    BOOST_CXX14_CONSTEXPR typename boost::lazy_disable_if_c< boost::is_same<R, Pred>::value, boost::mpl::identity<bool> >::type
 | 
			
		||||
    is_sorted ( const R &range, Pred p )
 | 
			
		||||
    {
 | 
			
		||||
        return boost::algorithm::is_sorted ( boost::begin ( range ), boost::end ( range ), p );
 | 
			
		||||
@@ -139,7 +139,7 @@ namespace boost { namespace algorithm {
 | 
			
		||||
/// \param range The range to be tested.
 | 
			
		||||
///
 | 
			
		||||
    template <typename R>
 | 
			
		||||
    bool is_sorted ( const R &range )
 | 
			
		||||
    BOOST_CXX14_CONSTEXPR bool is_sorted ( const R &range )
 | 
			
		||||
    {
 | 
			
		||||
        return boost::algorithm::is_sorted ( boost::begin ( range ), boost::end ( range ));
 | 
			
		||||
    }
 | 
			
		||||
@@ -159,7 +159,7 @@ namespace boost { namespace algorithm {
 | 
			
		||||
/// \note This function will return true for sequences that contain items that compare
 | 
			
		||||
///     equal. If that is not what you intended, you should use is_strictly_increasing instead.
 | 
			
		||||
    template <typename ForwardIterator>
 | 
			
		||||
    bool is_increasing ( ForwardIterator first, ForwardIterator last )
 | 
			
		||||
    BOOST_CXX14_CONSTEXPR bool is_increasing ( ForwardIterator first, ForwardIterator last )
 | 
			
		||||
    {
 | 
			
		||||
        typedef typename std::iterator_traits<ForwardIterator>::value_type value_type;
 | 
			
		||||
        return boost::algorithm::is_sorted (first, last, std::less<value_type>());
 | 
			
		||||
@@ -175,7 +175,7 @@ namespace boost { namespace algorithm {
 | 
			
		||||
/// \note This function will return true for sequences that contain items that compare
 | 
			
		||||
///     equal. If that is not what you intended, you should use is_strictly_increasing instead.
 | 
			
		||||
    template <typename R>
 | 
			
		||||
    bool is_increasing ( const R &range )
 | 
			
		||||
    BOOST_CXX14_CONSTEXPR bool is_increasing ( const R &range )
 | 
			
		||||
    {
 | 
			
		||||
        return is_increasing ( boost::begin ( range ), boost::end ( range ));
 | 
			
		||||
    }
 | 
			
		||||
@@ -192,7 +192,7 @@ namespace boost { namespace algorithm {
 | 
			
		||||
/// \note This function will return true for sequences that contain items that compare
 | 
			
		||||
///     equal. If that is not what you intended, you should use is_strictly_decreasing instead.
 | 
			
		||||
    template <typename ForwardIterator>
 | 
			
		||||
    bool is_decreasing ( ForwardIterator first, ForwardIterator last )
 | 
			
		||||
    BOOST_CXX14_CONSTEXPR bool is_decreasing ( ForwardIterator first, ForwardIterator last )
 | 
			
		||||
    {
 | 
			
		||||
        typedef typename std::iterator_traits<ForwardIterator>::value_type value_type;
 | 
			
		||||
        return boost::algorithm::is_sorted (first, last, std::greater<value_type>());
 | 
			
		||||
@@ -207,7 +207,7 @@ namespace boost { namespace algorithm {
 | 
			
		||||
/// \note This function will return true for sequences that contain items that compare
 | 
			
		||||
///     equal. If that is not what you intended, you should use is_strictly_decreasing instead.
 | 
			
		||||
    template <typename R>
 | 
			
		||||
    bool is_decreasing ( const R &range )
 | 
			
		||||
    BOOST_CXX14_CONSTEXPR bool is_decreasing ( const R &range )
 | 
			
		||||
    {
 | 
			
		||||
        return is_decreasing ( boost::begin ( range ), boost::end ( range ));
 | 
			
		||||
    }
 | 
			
		||||
@@ -224,7 +224,7 @@ namespace boost { namespace algorithm {
 | 
			
		||||
/// \note This function will return false for sequences that contain items that compare
 | 
			
		||||
///     equal. If that is not what you intended, you should use is_increasing instead.
 | 
			
		||||
    template <typename ForwardIterator>
 | 
			
		||||
    bool is_strictly_increasing ( ForwardIterator first, ForwardIterator last )
 | 
			
		||||
    BOOST_CXX14_CONSTEXPR bool is_strictly_increasing ( ForwardIterator first, ForwardIterator last )
 | 
			
		||||
    {
 | 
			
		||||
        typedef typename std::iterator_traits<ForwardIterator>::value_type value_type;
 | 
			
		||||
        return boost::algorithm::is_sorted (first, last, std::less_equal<value_type>());
 | 
			
		||||
@@ -239,7 +239,7 @@ namespace boost { namespace algorithm {
 | 
			
		||||
/// \note This function will return false for sequences that contain items that compare
 | 
			
		||||
///     equal. If that is not what you intended, you should use is_increasing instead.
 | 
			
		||||
    template <typename R>
 | 
			
		||||
    bool is_strictly_increasing ( const R &range )
 | 
			
		||||
    BOOST_CXX14_CONSTEXPR bool is_strictly_increasing ( const R &range )
 | 
			
		||||
    {
 | 
			
		||||
        return is_strictly_increasing ( boost::begin ( range ), boost::end ( range ));
 | 
			
		||||
    }
 | 
			
		||||
@@ -255,7 +255,7 @@ namespace boost { namespace algorithm {
 | 
			
		||||
/// \note This function will return false for sequences that contain items that compare
 | 
			
		||||
///     equal. If that is not what you intended, you should use is_decreasing instead.
 | 
			
		||||
    template <typename ForwardIterator>
 | 
			
		||||
    bool is_strictly_decreasing ( ForwardIterator first, ForwardIterator last )
 | 
			
		||||
    BOOST_CXX14_CONSTEXPR bool is_strictly_decreasing ( ForwardIterator first, ForwardIterator last )
 | 
			
		||||
    {
 | 
			
		||||
        typedef typename std::iterator_traits<ForwardIterator>::value_type value_type;
 | 
			
		||||
        return boost::algorithm::is_sorted (first, last, std::greater_equal<value_type>());
 | 
			
		||||
@@ -270,7 +270,7 @@ namespace boost { namespace algorithm {
 | 
			
		||||
/// \note This function will return false for sequences that contain items that compare
 | 
			
		||||
///     equal. If that is not what you intended, you should use is_decreasing instead.
 | 
			
		||||
    template <typename R>
 | 
			
		||||
    bool is_strictly_decreasing ( const R &range )
 | 
			
		||||
    BOOST_CXX14_CONSTEXPR bool is_strictly_decreasing ( const R &range )
 | 
			
		||||
    {
 | 
			
		||||
        return is_strictly_decreasing ( boost::begin ( range ), boost::end ( range ));
 | 
			
		||||
    }
 | 
			
		||||
 
 | 
			
		||||
@@ -26,7 +26,7 @@ namespace boost { namespace algorithm {
 | 
			
		||||
/// \param p     A predicate for testing the elements of the sequence
 | 
			
		||||
///
 | 
			
		||||
template<typename InputIterator, typename Predicate> 
 | 
			
		||||
bool none_of ( InputIterator first, InputIterator last, Predicate p )
 | 
			
		||||
BOOST_CXX14_CONSTEXPR bool none_of ( InputIterator first, InputIterator last, Predicate p )
 | 
			
		||||
{
 | 
			
		||||
    for ( ; first != last; ++first )
 | 
			
		||||
        if ( p(*first)) 
 | 
			
		||||
@@ -42,7 +42,7 @@ bool none_of ( InputIterator first, InputIterator last, Predicate p )
 | 
			
		||||
/// \param p     A predicate for testing the elements of the range
 | 
			
		||||
///
 | 
			
		||||
template<typename Range, typename Predicate> 
 | 
			
		||||
bool none_of ( const Range &r, Predicate p )
 | 
			
		||||
BOOST_CXX14_CONSTEXPR bool none_of ( const Range &r, Predicate p )
 | 
			
		||||
{
 | 
			
		||||
    return boost::algorithm::none_of (boost::begin (r), boost::end (r), p );
 | 
			
		||||
} 
 | 
			
		||||
@@ -56,7 +56,7 @@ bool none_of ( const Range &r, Predicate p )
 | 
			
		||||
/// \param val   A value to compare against
 | 
			
		||||
///
 | 
			
		||||
template<typename InputIterator, typename V> 
 | 
			
		||||
bool none_of_equal ( InputIterator first, InputIterator last, const V &val ) 
 | 
			
		||||
BOOST_CXX14_CONSTEXPR bool none_of_equal ( InputIterator first, InputIterator last, const V &val ) 
 | 
			
		||||
{
 | 
			
		||||
    for ( ; first != last; ++first )
 | 
			
		||||
        if ( val == *first )
 | 
			
		||||
@@ -72,7 +72,7 @@ bool none_of_equal ( InputIterator first, InputIterator last, const V &val )
 | 
			
		||||
/// \param val   A value to compare against
 | 
			
		||||
///
 | 
			
		||||
template<typename Range, typename V> 
 | 
			
		||||
bool none_of_equal ( const Range &r, const V & val ) 
 | 
			
		||||
BOOST_CXX14_CONSTEXPR bool none_of_equal ( const Range &r, const V & val ) 
 | 
			
		||||
{
 | 
			
		||||
    return boost::algorithm::none_of_equal (boost::begin (r), boost::end (r), val);
 | 
			
		||||
} 
 | 
			
		||||
 
 | 
			
		||||
@@ -12,7 +12,6 @@
 | 
			
		||||
#ifndef BOOST_ALGORITHM_ONE_OF_HPP
 | 
			
		||||
#define BOOST_ALGORITHM_ONE_OF_HPP
 | 
			
		||||
 | 
			
		||||
#include <algorithm>            // for std::find and std::find_if
 | 
			
		||||
#include <boost/algorithm/cxx11/none_of.hpp>
 | 
			
		||||
 | 
			
		||||
#include <boost/range/begin.hpp>
 | 
			
		||||
@@ -28,12 +27,16 @@ namespace boost { namespace algorithm {
 | 
			
		||||
/// \param p     A predicate for testing the elements of the sequence
 | 
			
		||||
///
 | 
			
		||||
template<typename InputIterator, typename Predicate> 
 | 
			
		||||
bool one_of ( InputIterator first, InputIterator last, Predicate p )
 | 
			
		||||
BOOST_CXX14_CONSTEXPR bool one_of ( InputIterator first, InputIterator last, Predicate p )
 | 
			
		||||
{
 | 
			
		||||
    InputIterator i = std::find_if (first, last, p);
 | 
			
		||||
    if (i == last)
 | 
			
		||||
//  find_if
 | 
			
		||||
    for (; first != last; ++first)
 | 
			
		||||
        if (p(*first))
 | 
			
		||||
            break;
 | 
			
		||||
 | 
			
		||||
    if (first == last)
 | 
			
		||||
        return false;    // Didn't occur at all
 | 
			
		||||
    return boost::algorithm::none_of (++i, last, p);
 | 
			
		||||
    return boost::algorithm::none_of (++first, last, p);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/// \fn one_of ( const Range &r, Predicate p )
 | 
			
		||||
@@ -43,7 +46,7 @@ bool one_of ( InputIterator first, InputIterator last, Predicate p )
 | 
			
		||||
/// \param p    A predicate for testing the elements of the range
 | 
			
		||||
///
 | 
			
		||||
template<typename Range, typename Predicate> 
 | 
			
		||||
bool one_of ( const Range &r, Predicate p ) 
 | 
			
		||||
BOOST_CXX14_CONSTEXPR bool one_of ( const Range &r, Predicate p )
 | 
			
		||||
{
 | 
			
		||||
    return boost::algorithm::one_of ( boost::begin (r), boost::end (r), p );
 | 
			
		||||
}
 | 
			
		||||
@@ -57,12 +60,16 @@ bool one_of ( const Range &r, Predicate p )
 | 
			
		||||
/// \param val      A value to compare against
 | 
			
		||||
///
 | 
			
		||||
template<typename InputIterator, typename V> 
 | 
			
		||||
bool one_of_equal ( InputIterator first, InputIterator last, const V &val )
 | 
			
		||||
BOOST_CXX14_CONSTEXPR bool one_of_equal ( InputIterator first, InputIterator last, const V &val )
 | 
			
		||||
{
 | 
			
		||||
    InputIterator i = std::find (first, last, val); // find first occurrence of 'val'
 | 
			
		||||
    if (i == last)
 | 
			
		||||
//  find
 | 
			
		||||
    for (; first != last; ++first)
 | 
			
		||||
        if (*first == val)
 | 
			
		||||
            break;
 | 
			
		||||
 | 
			
		||||
    if (first == last)
 | 
			
		||||
        return false;                    // Didn't occur at all
 | 
			
		||||
    return boost::algorithm::none_of_equal (++i, last, val);
 | 
			
		||||
    return boost::algorithm::none_of_equal (++first, last, val);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/// \fn one_of_equal ( const Range &r, const V &val )
 | 
			
		||||
@@ -72,7 +79,7 @@ bool one_of_equal ( InputIterator first, InputIterator last, const V &val )
 | 
			
		||||
/// \param val  A value to compare against
 | 
			
		||||
///
 | 
			
		||||
template<typename Range, typename V> 
 | 
			
		||||
bool one_of_equal ( const Range &r, const V &val )
 | 
			
		||||
BOOST_CXX14_CONSTEXPR bool one_of_equal ( const Range &r, const V &val )
 | 
			
		||||
{
 | 
			
		||||
    return boost::algorithm::one_of_equal ( boost::begin (r), boost::end (r), val );
 | 
			
		||||
} 
 | 
			
		||||
 
 | 
			
		||||
@@ -14,6 +14,7 @@
 | 
			
		||||
 | 
			
		||||
#include <utility>  // for std::pair
 | 
			
		||||
 | 
			
		||||
#include <boost/config.hpp>
 | 
			
		||||
#include <boost/range/begin.hpp>
 | 
			
		||||
#include <boost/range/end.hpp>
 | 
			
		||||
 | 
			
		||||
@@ -35,7 +36,7 @@ namespace boost { namespace algorithm {
 | 
			
		||||
/// \note            This function is part of the C++2011 standard library.
 | 
			
		||||
template <typename InputIterator, 
 | 
			
		||||
        typename OutputIterator1, typename OutputIterator2, typename UnaryPredicate>
 | 
			
		||||
std::pair<OutputIterator1, OutputIterator2>
 | 
			
		||||
BOOST_CXX14_CONSTEXPR std::pair<OutputIterator1, OutputIterator2>
 | 
			
		||||
partition_copy ( InputIterator first, InputIterator last,
 | 
			
		||||
        OutputIterator1 out_true, OutputIterator2 out_false, UnaryPredicate p )
 | 
			
		||||
{
 | 
			
		||||
@@ -57,7 +58,7 @@ partition_copy ( InputIterator first, InputIterator last,
 | 
			
		||||
///
 | 
			
		||||
template <typename Range, typename OutputIterator1, typename OutputIterator2, 
 | 
			
		||||
            typename UnaryPredicate>
 | 
			
		||||
std::pair<OutputIterator1, OutputIterator2>
 | 
			
		||||
BOOST_CXX14_CONSTEXPR std::pair<OutputIterator1, OutputIterator2>
 | 
			
		||||
partition_copy ( const Range &r, OutputIterator1 out_true, OutputIterator2 out_false, 
 | 
			
		||||
                                UnaryPredicate p )
 | 
			
		||||
{
 | 
			
		||||
 
 | 
			
		||||
@@ -12,7 +12,6 @@
 | 
			
		||||
#ifndef BOOST_ALGORITHM_EQUAL_HPP
 | 
			
		||||
#define BOOST_ALGORITHM_EQUAL_HPP
 | 
			
		||||
 | 
			
		||||
#include <algorithm>    // for std::equal
 | 
			
		||||
#include <iterator>
 | 
			
		||||
 | 
			
		||||
namespace boost { namespace algorithm {
 | 
			
		||||
@@ -21,10 +20,11 @@ namespace detail {
 | 
			
		||||
 | 
			
		||||
    template <class T1, class T2>
 | 
			
		||||
    struct eq {
 | 
			
		||||
        bool operator () ( const T1& v1, const T2& v2 ) const { return v1 == v2 ;}
 | 
			
		||||
        BOOST_CONSTEXPR bool operator () ( const T1& v1, const T2& v2 ) const { return v1 == v2 ;}
 | 
			
		||||
        };
 | 
			
		||||
    
 | 
			
		||||
    template <class RandomAccessIterator1, class RandomAccessIterator2, class BinaryPredicate>
 | 
			
		||||
    BOOST_CXX14_CONSTEXPR
 | 
			
		||||
    bool equal ( RandomAccessIterator1 first1, RandomAccessIterator1 last1, 
 | 
			
		||||
                 RandomAccessIterator2 first2, RandomAccessIterator2 last2, BinaryPredicate pred,
 | 
			
		||||
                 std::random_access_iterator_tag, std::random_access_iterator_tag )
 | 
			
		||||
@@ -32,11 +32,16 @@ namespace detail {
 | 
			
		||||
    //  Random-access iterators let is check the sizes in constant time
 | 
			
		||||
        if ( std::distance ( first1, last1 ) != std::distance ( first2, last2 ))
 | 
			
		||||
            return false;
 | 
			
		||||
    // If we know that the sequences are the same size, the original version is fine
 | 
			
		||||
        return std::equal ( first1, last1, first2, pred );
 | 
			
		||||
 | 
			
		||||
    //  std::equal
 | 
			
		||||
        for (; first1 != last1; ++first1, ++first2)
 | 
			
		||||
            if (!pred(*first1, *first2))
 | 
			
		||||
                return false;
 | 
			
		||||
        return true;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    template <class InputIterator1, class InputIterator2, class BinaryPredicate>
 | 
			
		||||
    BOOST_CXX14_CONSTEXPR
 | 
			
		||||
    bool equal ( InputIterator1 first1, InputIterator1 last1, 
 | 
			
		||||
                 InputIterator2 first2, InputIterator2 last2, BinaryPredicate pred,
 | 
			
		||||
                 std::input_iterator_tag, std::input_iterator_tag )
 | 
			
		||||
@@ -60,6 +65,7 @@ namespace detail {
 | 
			
		||||
/// \param last2     One past the end of the second range.
 | 
			
		||||
/// \param pred      A predicate for comparing the elements of the ranges
 | 
			
		||||
template <class InputIterator1, class InputIterator2, class BinaryPredicate>
 | 
			
		||||
BOOST_CXX14_CONSTEXPR
 | 
			
		||||
bool equal ( InputIterator1 first1, InputIterator1 last1, 
 | 
			
		||||
             InputIterator2 first2, InputIterator2 last2, BinaryPredicate pred )
 | 
			
		||||
{
 | 
			
		||||
@@ -78,6 +84,7 @@ bool equal ( InputIterator1 first1, InputIterator1 last1,
 | 
			
		||||
/// \param first2    The start of the second range.
 | 
			
		||||
/// \param last2     One past the end of the second range.
 | 
			
		||||
template <class InputIterator1, class InputIterator2>
 | 
			
		||||
BOOST_CXX14_CONSTEXPR
 | 
			
		||||
bool equal ( InputIterator1 first1, InputIterator1 last1, 
 | 
			
		||||
             InputIterator2 first2, InputIterator2 last2 )
 | 
			
		||||
{
 | 
			
		||||
 
 | 
			
		||||
@@ -13,6 +13,7 @@
 | 
			
		||||
#define BOOST_ALGORITHM_MISMATCH_HPP
 | 
			
		||||
 | 
			
		||||
#include <utility>      // for std::pair
 | 
			
		||||
#include <boost/config.hpp>
 | 
			
		||||
 | 
			
		||||
namespace boost { namespace algorithm {
 | 
			
		||||
 | 
			
		||||
@@ -27,7 +28,7 @@ namespace boost { namespace algorithm {
 | 
			
		||||
/// \param last2     One past the end of the second range.
 | 
			
		||||
/// \param pred      A predicate for comparing the elements of the ranges
 | 
			
		||||
template <class InputIterator1, class InputIterator2, class BinaryPredicate>
 | 
			
		||||
std::pair<InputIterator1, InputIterator2> mismatch (
 | 
			
		||||
BOOST_CXX14_CONSTEXPR std::pair<InputIterator1, InputIterator2> mismatch (
 | 
			
		||||
                    InputIterator1 first1, InputIterator1 last1,
 | 
			
		||||
                    InputIterator2 first2, InputIterator2 last2,
 | 
			
		||||
                    BinaryPredicate pred )
 | 
			
		||||
@@ -47,7 +48,7 @@ std::pair<InputIterator1, InputIterator2> mismatch (
 | 
			
		||||
/// \param first2    The start of the second range.
 | 
			
		||||
/// \param last2     One past the end of the second range.
 | 
			
		||||
template <class InputIterator1, class InputIterator2>
 | 
			
		||||
std::pair<InputIterator1, InputIterator2> mismatch (
 | 
			
		||||
BOOST_CXX14_CONSTEXPR std::pair<InputIterator1, InputIterator2> mismatch (
 | 
			
		||||
                    InputIterator1 first1, InputIterator1 last1,
 | 
			
		||||
                    InputIterator2 first2, InputIterator2 last2 )
 | 
			
		||||
{
 | 
			
		||||
 
 | 
			
		||||
@@ -44,7 +44,7 @@ OutputIterator exclusive_scan(InputIterator first, InputIterator last,
 | 
			
		||||
                              OutputIterator result, T init)
 | 
			
		||||
{
 | 
			
		||||
	typedef typename std::iterator_traits<InputIterator>::value_type VT;
 | 
			
		||||
    return exclusive_scan(first, last, result, init, std::plus<VT>());
 | 
			
		||||
    return boost::algorithm::exclusive_scan(first, last, result, init, std::plus<VT>());
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
}} // namespace boost and algorithm
 | 
			
		||||
 
 | 
			
		||||
@@ -41,7 +41,7 @@ OutputIterator inclusive_scan(InputIterator first, InputIterator last,
 | 
			
		||||
        typename std::iterator_traits<InputIterator>::value_type init = *first;
 | 
			
		||||
        *result++ = init;
 | 
			
		||||
        if (++first != last)
 | 
			
		||||
            return inclusive_scan(first, last, result, bOp, init);
 | 
			
		||||
            return boost::algorithm::inclusive_scan(first, last, result, bOp, init);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
    return result;
 | 
			
		||||
@@ -52,7 +52,7 @@ OutputIterator inclusive_scan(InputIterator first, InputIterator last,
 | 
			
		||||
                   OutputIterator result)
 | 
			
		||||
{
 | 
			
		||||
    typedef typename std::iterator_traits<InputIterator>::value_type VT;
 | 
			
		||||
    return inclusive_scan(first, last, result, std::plus<VT>());
 | 
			
		||||
    return boost::algorithm::inclusive_scan(first, last, result, std::plus<VT>());
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
}} // namespace boost and algorithm
 | 
			
		||||
 
 | 
			
		||||
@@ -34,14 +34,14 @@ template<class InputIterator, class T>
 | 
			
		||||
T reduce(InputIterator first, InputIterator last, T init)
 | 
			
		||||
{
 | 
			
		||||
	typedef typename std::iterator_traits<InputIterator>::value_type VT;
 | 
			
		||||
    return reduce(first, last, init, std::plus<VT>());
 | 
			
		||||
    return boost::algorithm::reduce(first, last, init, std::plus<VT>());
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
template<class InputIterator>
 | 
			
		||||
typename std::iterator_traits<InputIterator>::value_type
 | 
			
		||||
reduce(InputIterator first, InputIterator last)
 | 
			
		||||
{
 | 
			
		||||
    return reduce(first, last,
 | 
			
		||||
    return boost::algorithm::reduce(first, last,
 | 
			
		||||
       typename std::iterator_traits<InputIterator>::value_type());
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@@ -49,14 +49,14 @@ template<class Range>
 | 
			
		||||
typename boost::range_value<Range>::type
 | 
			
		||||
reduce(const Range &r)
 | 
			
		||||
{
 | 
			
		||||
    return reduce(boost::begin(r), boost::end(r));
 | 
			
		||||
    return boost::algorithm::reduce(boost::begin(r), boost::end(r));
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
//	Not sure that this won't be ambiguous (1)
 | 
			
		||||
template<class Range, class T>
 | 
			
		||||
T reduce(const Range &r, T init)
 | 
			
		||||
{
 | 
			
		||||
    return reduce(boost::begin (r), boost::end (r), init);
 | 
			
		||||
    return boost::algorithm::reduce(boost::begin (r), boost::end (r), init);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@@ -64,7 +64,7 @@ T reduce(const Range &r, T init)
 | 
			
		||||
template<class Range, class T, class BinaryOperation>
 | 
			
		||||
T reduce(const Range &r, T init, BinaryOperation bOp)
 | 
			
		||||
{
 | 
			
		||||
    return reduce(boost::begin(r), boost::end(r), init, bOp);
 | 
			
		||||
    return boost::algorithm::reduce(boost::begin(r), boost::end(r), init, bOp);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
}} // namespace boost and algorithm
 | 
			
		||||
 
 | 
			
		||||
@@ -46,7 +46,8 @@ OutputIterator transform_inclusive_scan(InputIterator first, InputIterator last,
 | 
			
		||||
        typename std::iterator_traits<InputIterator>::value_type init = uOp(*first);
 | 
			
		||||
        *result++ = init;
 | 
			
		||||
        if (++first != last)
 | 
			
		||||
            return transform_inclusive_scan(first, last, result, bOp, uOp, init);
 | 
			
		||||
            return boost::algorithm::transform_inclusive_scan
 | 
			
		||||
                                              (first, last, result, bOp, uOp, init);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
    return result;
 | 
			
		||||
 
 | 
			
		||||
@@ -46,7 +46,7 @@ template<class InputIterator1, class InputIterator2, class T>
 | 
			
		||||
T transform_reduce(InputIterator1 first1, InputIterator1 last1,
 | 
			
		||||
                   InputIterator2 first2, T init)
 | 
			
		||||
{
 | 
			
		||||
    return transform_reduce(first1, last1, first2, init,
 | 
			
		||||
    return boost::algorithm::transform_reduce(first1, last1, first2, init,
 | 
			
		||||
                            std::plus<T>(), std::multiplies<T>());
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -43,7 +43,6 @@ namespace boost {
 | 
			
		||||
            The result is given as an \c iterator_range delimiting the match.
 | 
			
		||||
 | 
			
		||||
            \param Search A substring to be searched for.
 | 
			
		||||
            \param Comp An element comparison predicate
 | 
			
		||||
            \return An instance of the \c first_finder object
 | 
			
		||||
        */
 | 
			
		||||
        template<typename RangeT>
 | 
			
		||||
@@ -84,7 +83,6 @@ namespace boost {
 | 
			
		||||
            The result is given as an \c iterator_range delimiting the match.
 | 
			
		||||
 | 
			
		||||
            \param Search A substring to be searched for.
 | 
			
		||||
            \param Comp An element comparison predicate
 | 
			
		||||
            \return An instance of the \c last_finder object
 | 
			
		||||
        */
 | 
			
		||||
        template<typename RangeT>
 | 
			
		||||
@@ -124,7 +122,6 @@ namespace boost {
 | 
			
		||||
 | 
			
		||||
            \param Search A substring to be searched for.
 | 
			
		||||
            \param Nth An index of the match to be find
 | 
			
		||||
            \param Comp An element comparison predicate
 | 
			
		||||
            \return An instance of the \c nth_finder object
 | 
			
		||||
        */
 | 
			
		||||
        template<typename RangeT>
 | 
			
		||||
@@ -230,7 +227,6 @@ namespace boost {
 | 
			
		||||
 | 
			
		||||
            \param Begin Beginning of the range
 | 
			
		||||
            \param End End of the range
 | 
			
		||||
            \param Range The range.
 | 
			
		||||
            \return An instance of the \c range_finger object
 | 
			
		||||
        */
 | 
			
		||||
        template< typename ForwardIteratorT >
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user