|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r61495 - in trunk/boost/range: adaptor algorithm
From: neil_at_[hidden]
Date: 2010-04-22 18:43:59
Author: neilgroves
Date: 2010-04-22 18:43:57 EDT (Thu, 22 Apr 2010)
New Revision: 61495
URL: http://svn.boost.org/trac/boost/changeset/61495
Log:
Boost.Range brought back some of the const overloads that were over-zealously removed.
Text files modified:
trunk/boost/range/adaptor/sliced.hpp | 47 ++++++++++++++------
trunk/boost/range/algorithm/adjacent_find.hpp | 65 +++++++++++++++++++++++++---
trunk/boost/range/algorithm/count.hpp | 9 +++
trunk/boost/range/algorithm/count_if.hpp | 9 +++
trunk/boost/range/algorithm/equal_range.hpp | 24 ++++++++++
trunk/boost/range/algorithm/for_each.hpp | 8 +++
trunk/boost/range/algorithm/inplace_merge.hpp | 21 +++++++++
trunk/boost/range/algorithm/max_element.hpp | 40 +++++++++++++++++
trunk/boost/range/algorithm/min_element.hpp | 40 +++++++++++++++++
trunk/boost/range/algorithm/mismatch.hpp | 91 ++++++++++++++++++++++++++++++++++++++++
trunk/boost/range/algorithm/nth_element.hpp | 21 +++++++++
trunk/boost/range/algorithm/permutation.hpp | 36 +++++++++++++++
trunk/boost/range/algorithm/search.hpp | 49 +++++++++++++++++++++
trunk/boost/range/algorithm/search_n.hpp | 58 +++++++++++++++++++++++++
trunk/boost/range/algorithm/stable_partition.hpp | 20 ++++++++
trunk/boost/range/algorithm/unique.hpp | 36 +++++++++++++++
16 files changed, 552 insertions(+), 22 deletions(-)
Modified: trunk/boost/range/adaptor/sliced.hpp
==============================================================================
--- trunk/boost/range/adaptor/sliced.hpp (original)
+++ trunk/boost/range/adaptor/sliced.hpp 2010-04-22 18:43:57 EDT (Thu, 22 Apr 2010)
@@ -27,24 +27,43 @@
std::size_t u;
};
- template< class RandomAccessRange >
- inline iterator_range< BOOST_DEDUCED_TYPENAME range_iterator<RandomAccessRange>::type >
- slice( RandomAccessRange& rng, std::size_t t, std::size_t u )
- {
- BOOST_ASSERT( t <= u && "error in slice indices" );
+ template< class RandomAccessRange >
+ inline iterator_range< BOOST_DEDUCED_TYPENAME range_iterator<RandomAccessRange>::type >
+ slice( RandomAccessRange& rng, std::size_t t, std::size_t u )
+ {
+ BOOST_ASSERT( t <= u && "error in slice indices" );
BOOST_ASSERT( static_cast<std::size_t>(boost::size(rng)) >= u &&
- "second slice index out of bounds" );
+ "second slice index out of bounds" );
+
+ return boost::make_iterator_range( rng, t, u - boost::size(rng) );
+ }
+
+ template< class RandomAccessRange >
+ inline iterator_range< BOOST_DEDUCED_TYPENAME range_iterator<const RandomAccessRange>::type >
+ slice( const RandomAccessRange& rng, std::size_t t, std::size_t u )
+ {
+ BOOST_ASSERT( t <= u && "error in slice indices" );
+ BOOST_ASSERT( static_cast<std::size_t>(boost::size(rng)) >= u &&
+ "second slice index out of bounds" );
return boost::make_iterator_range( rng, t, u - boost::size(rng) );
- }
+ }
+
+ template< class RandomAccessRange >
+ inline iterator_range<
+ BOOST_DEDUCED_TYPENAME range_iterator<RandomAccessRange>::type >
+ operator|( RandomAccessRange& r, const sliced& f )
+ {
+ return adaptors::slice( r, f.t, f.u );
+ }
- template< class RandomAccessRange >
- inline iterator_range<
- BOOST_DEDUCED_TYPENAME range_iterator<RandomAccessRange>::type >
- operator|( RandomAccessRange& r, const sliced& f )
- {
- return adaptors::slice( r, f.t, f.u );
- }
+ template< class RandomAccessRange >
+ inline iterator_range<
+ BOOST_DEDUCED_TYPENAME range_iterator<const RandomAccessRange>::type >
+ operator|( const RandomAccessRange& r, const sliced& f )
+ {
+ return adaptors::slice( r, f.t, f.u );
+ }
} // namespace adaptors
} // namespace boost
Modified: trunk/boost/range/algorithm/adjacent_find.hpp
==============================================================================
--- trunk/boost/range/algorithm/adjacent_find.hpp (original)
+++ trunk/boost/range/algorithm/adjacent_find.hpp 2010-04-22 18:43:57 EDT (Thu, 22 Apr 2010)
@@ -28,8 +28,8 @@
///
/// \pre ForwardRange is a model of the ForwardRangeConcept
/// \pre BinaryPredicate is a model of the BinaryPredicateConcept
-template< class ForwardRange >
-inline BOOST_DEDUCED_TYPENAME range_iterator<ForwardRange>::type
+template< typename ForwardRange >
+inline typename range_iterator<ForwardRange>::type
adjacent_find(ForwardRange & rng)
{
BOOST_RANGE_CONCEPT_ASSERT((ForwardRangeConcept<ForwardRange>));
@@ -37,19 +37,43 @@
}
/// \overload
-template< class ForwardRange, class BinaryPredicate >
-inline BOOST_DEDUCED_TYPENAME range_iterator<ForwardRange>::type
+template< typename ForwardRange >
+inline typename range_iterator<const ForwardRange>::type
+adjacent_find(const ForwardRange& rng)
+{
+ BOOST_RANGE_CONCEPT_ASSERT((ForwardRangeConcept<ForwardRange>));
+ return std::adjacent_find(boost::begin(rng),boost::end(rng));
+}
+
+/// \overload
+template< typename ForwardRange, typename BinaryPredicate >
+inline typename range_iterator<ForwardRange>::type
adjacent_find(ForwardRange & rng, BinaryPredicate pred)
{
BOOST_RANGE_CONCEPT_ASSERT((ForwardRangeConcept<ForwardRange>));
+ BOOST_RANGE_CONCEPT_ASSERT((BinaryPredicateConcept<BinaryPredicate,
+ typename range_value<ForwardRange>::type,
+ typename range_value<ForwardRange>::type>));
+ return std::adjacent_find(boost::begin(rng),boost::end(rng),pred);
+}
+
+/// \overload
+template< typename ForwardRange, typename BinaryPredicate >
+inline typename range_iterator<const ForwardRange>::type
+adjacent_find(const ForwardRange& rng, BinaryPredicate pred)
+{
+ BOOST_RANGE_CONCEPT_ASSERT((ForwardRangeConcept<ForwardRange>));
+ BOOST_RANGE_CONCEPT_ASSERT((BinaryPredicateConcept<BinaryPredicate,
+ typename range_value<const ForwardRange>::type,
+ typename range_value<const ForwardRange>::type>));
return std::adjacent_find(boost::begin(rng),boost::end(rng),pred);
}
// range_return overloads
/// \overload
-template< range_return_value re, class ForwardRange >
-inline BOOST_DEDUCED_TYPENAME range_return<ForwardRange,re>::type
+template< range_return_value re, typename ForwardRange >
+inline typename range_return<ForwardRange,re>::type
adjacent_find(ForwardRange & rng)
{
BOOST_RANGE_CONCEPT_ASSERT((ForwardRangeConcept<ForwardRange>));
@@ -59,16 +83,41 @@
}
/// \overload
-template< range_return_value re, class ForwardRange, class BinaryPredicate >
-inline BOOST_DEDUCED_TYPENAME range_return<ForwardRange,re>::type
+template< range_return_value re, typename ForwardRange >
+inline typename range_return<const ForwardRange,re>::type
+adjacent_find(const ForwardRange& rng)
+{
+ BOOST_RANGE_CONCEPT_ASSERT((ForwardRangeConcept<ForwardRange>));
+ return range_return<const ForwardRange,re>::
+ pack(std::adjacent_find(boost::begin(rng),boost::end(rng)),
+ rng);
+}
+
+/// \overload
+template< range_return_value re, typename ForwardRange, typename BinaryPredicate >
+inline typename range_return<ForwardRange,re>::type
adjacent_find(ForwardRange& rng, BinaryPredicate pred)
{
BOOST_RANGE_CONCEPT_ASSERT((ForwardRangeConcept<ForwardRange>));
+ BOOST_RANGE_CONCEPT_ASSERT((BinaryPredicateConcept<BinaryPredicate,
+ typename range_value<ForwardRange>::type,
+ typename range_value<ForwardRange>::type>));
return range_return<ForwardRange,re>::
pack(std::adjacent_find(boost::begin(rng),boost::end(rng),pred),
rng);
}
+/// \overload
+template< range_return_value re, typename ForwardRange, typename BinaryPredicate >
+inline typename range_return<const ForwardRange,re>::type
+adjacent_find(const ForwardRange& rng, BinaryPredicate pred)
+{
+ BOOST_RANGE_CONCEPT_ASSERT((ForwardRangeConcept<ForwardRange>));
+ return range_return<const ForwardRange,re>::
+ pack(std::adjacent_find(boost::begin(rng),boost::end(rng),pred),
+ rng);
+}
+
} // namespace range
using range::adjacent_find;
} // namespace boost
Modified: trunk/boost/range/algorithm/count.hpp
==============================================================================
--- trunk/boost/range/algorithm/count.hpp (original)
+++ trunk/boost/range/algorithm/count.hpp 2010-04-22 18:43:57 EDT (Thu, 22 Apr 2010)
@@ -27,6 +27,15 @@
///
/// \pre SinglePassRange is a model of the SinglePassRangeConcept
template< class SinglePassRange, class Value >
+inline BOOST_DEDUCED_TYPENAME range_difference<SinglePassRange>::type
+count(SinglePassRange& rng, const Value& val)
+{
+ BOOST_RANGE_CONCEPT_ASSERT(( SinglePassRangeConcept<SinglePassRange> ));
+ return std::count(boost::begin(rng), boost::end(rng), val);
+}
+
+/// \overload
+template< class SinglePassRange, class Value >
inline BOOST_DEDUCED_TYPENAME range_difference<SinglePassRange const>::type
count(const SinglePassRange& rng, const Value& val)
{
Modified: trunk/boost/range/algorithm/count_if.hpp
==============================================================================
--- trunk/boost/range/algorithm/count_if.hpp (original)
+++ trunk/boost/range/algorithm/count_if.hpp 2010-04-22 18:43:57 EDT (Thu, 22 Apr 2010)
@@ -28,6 +28,15 @@
/// \pre SinglePassRange is a model of the SinglePassRangeConcept
/// \pre UnaryPredicate is a model of the UnaryPredicateConcept
template< class SinglePassRange, class UnaryPredicate >
+inline BOOST_DEDUCED_TYPENAME boost::range_difference<SinglePassRange>::type
+count_if(SinglePassRange& rng, UnaryPredicate pred)
+{
+ BOOST_RANGE_CONCEPT_ASSERT(( SinglePassRangeConcept<SinglePassRange> ));
+ return std::count_if(boost::begin(rng), boost::end(rng), pred);
+}
+
+/// \overload
+template< class SinglePassRange, class UnaryPredicate >
inline BOOST_DEDUCED_TYPENAME boost::range_difference<const SinglePassRange>::type
count_if(const SinglePassRange& rng, UnaryPredicate pred)
{
Modified: trunk/boost/range/algorithm/equal_range.hpp
==============================================================================
--- trunk/boost/range/algorithm/equal_range.hpp (original)
+++ trunk/boost/range/algorithm/equal_range.hpp 2010-04-22 18:43:57 EDT (Thu, 22 Apr 2010)
@@ -38,6 +38,18 @@
}
/// \overload
+template<class ForwardRange, class Value>
+inline std::pair<
+ BOOST_DEDUCED_TYPENAME boost::range_iterator<const ForwardRange>::type,
+ BOOST_DEDUCED_TYPENAME boost::range_iterator<const ForwardRange>::type
+ >
+equal_range(const ForwardRange& rng, const Value& val)
+{
+ BOOST_RANGE_CONCEPT_ASSERT(( ForwardRangeConcept<const ForwardRange> ));
+ return std::equal_range(boost::begin(rng), boost::end(rng), val);
+}
+
+/// \overload
template<class ForwardRange, class Value, class SortPredicate>
inline std::pair<
BOOST_DEDUCED_TYPENAME boost::range_iterator<ForwardRange>::type,
@@ -49,6 +61,18 @@
return std::equal_range(boost::begin(rng), boost::end(rng), val, pred);
}
+/// \overload
+template<class ForwardRange, class Value, class SortPredicate>
+inline std::pair<
+ BOOST_DEDUCED_TYPENAME boost::range_iterator<const ForwardRange>::type,
+ BOOST_DEDUCED_TYPENAME boost::range_iterator<const ForwardRange>::type
+ >
+equal_range(const ForwardRange& rng, const Value& val, SortPredicate pred)
+{
+ BOOST_RANGE_CONCEPT_ASSERT(( ForwardRangeConcept<const ForwardRange> ));
+ return std::equal_range(boost::begin(rng), boost::end(rng), val, pred);
+}
+
} // namespace range
using range::equal_range;
} // namespace boost
Modified: trunk/boost/range/algorithm/for_each.hpp
==============================================================================
--- trunk/boost/range/algorithm/for_each.hpp (original)
+++ trunk/boost/range/algorithm/for_each.hpp 2010-04-22 18:43:57 EDT (Thu, 22 Apr 2010)
@@ -33,6 +33,14 @@
return std::for_each(boost::begin(rng),boost::end(rng),fun);
}
+/// \overload
+template< class SinglePassRange, class UnaryFunction >
+inline UnaryFunction for_each(const SinglePassRange& rng, UnaryFunction fun)
+{
+ BOOST_RANGE_CONCEPT_ASSERT(( SinglePassRangeConcept<const SinglePassRange> ));
+ return std::for_each(boost::begin(rng), boost::end(rng), fun);
+}
+
} // namespace range
using range::for_each;
} // namespace boost
Modified: trunk/boost/range/algorithm/inplace_merge.hpp
==============================================================================
--- trunk/boost/range/algorithm/inplace_merge.hpp (original)
+++ trunk/boost/range/algorithm/inplace_merge.hpp 2010-04-22 18:43:57 EDT (Thu, 22 Apr 2010)
@@ -36,6 +36,16 @@
}
/// \overload
+template<class BidirectionalRange>
+inline const BidirectionalRange& inplace_merge(const BidirectionalRange& rng,
+ BOOST_DEDUCED_TYPENAME boost::range_iterator<const BidirectionalRange>::type middle)
+{
+ BOOST_RANGE_CONCEPT_ASSERT(( BidirectionalRangeConcept<const BidirectionalRange> ));
+ std::inplace_merge(boost::begin(rng), middle, boost::end(rng));
+ return rng;
+}
+
+/// \overload
template<class BidirectionalRange, class BinaryPredicate>
inline BidirectionalRange& inplace_merge(BidirectionalRange& rng,
BOOST_DEDUCED_TYPENAME boost::range_iterator<BidirectionalRange>::type middle,
@@ -46,6 +56,17 @@
return rng;
}
+/// \overload
+template<class BidirectionalRange, class BinaryPredicate>
+inline const BidirectionalRange& inplace_merge(const BidirectionalRange& rng,
+ BOOST_DEDUCED_TYPENAME boost::range_iterator<const BidirectionalRange>::type middle,
+ BinaryPredicate pred)
+{
+ BOOST_RANGE_CONCEPT_ASSERT(( BidirectionalRangeConcept<const BidirectionalRange> ));
+ std::inplace_merge(boost::begin(rng), middle, boost::end(rng), pred);
+ return rng;
+}
+
} // namespace range
using range::inplace_merge;
} // namespace boost
Modified: trunk/boost/range/algorithm/max_element.hpp
==============================================================================
--- trunk/boost/range/algorithm/max_element.hpp (original)
+++ trunk/boost/range/algorithm/max_element.hpp 2010-04-22 18:43:57 EDT (Thu, 22 Apr 2010)
@@ -36,6 +36,15 @@
}
/// \overload
+template<class ForwardRange>
+inline BOOST_DEDUCED_TYPENAME range_iterator<const ForwardRange>::type
+max_element(const ForwardRange& rng)
+{
+ BOOST_RANGE_CONCEPT_ASSERT(( ForwardRangeConcept<const ForwardRange> ));
+ return std::max_element(boost::begin(rng), boost::end(rng));
+}
+
+/// \overload
template<class ForwardRange, class BinaryPredicate>
inline BOOST_DEDUCED_TYPENAME range_iterator<ForwardRange>::type
max_element(ForwardRange& rng, BinaryPredicate pred)
@@ -44,6 +53,15 @@
return std::max_element(boost::begin(rng), boost::end(rng), pred);
}
+/// \overload
+template<class ForwardRange, class BinaryPredicate>
+inline BOOST_DEDUCED_TYPENAME range_iterator<const ForwardRange>::type
+max_element(const ForwardRange& rng, BinaryPredicate pred)
+{
+ BOOST_RANGE_CONCEPT_ASSERT(( ForwardRangeConcept<const ForwardRange> ));
+ return std::max_element(boost::begin(rng), boost::end(rng), pred);
+}
+
// range_return overloads
/// \overload
@@ -58,6 +76,17 @@
}
/// \overload
+template<range_return_value re, class ForwardRange>
+inline BOOST_DEDUCED_TYPENAME range_return<const ForwardRange,re>::type
+max_element(const ForwardRange& rng)
+{
+ BOOST_RANGE_CONCEPT_ASSERT(( ForwardRangeConcept<const ForwardRange> ));
+ return range_return<const ForwardRange,re>::pack(
+ std::max_element(boost::begin(rng), boost::end(rng)),
+ rng);
+}
+
+/// \overload
template<range_return_value re, class ForwardRange, class BinaryPredicate>
inline BOOST_DEDUCED_TYPENAME range_return<ForwardRange,re>::type
max_element(ForwardRange& rng, BinaryPredicate pred)
@@ -68,6 +97,17 @@
rng);
}
+/// \overload
+template<range_return_value re, class ForwardRange, class BinaryPredicate>
+inline BOOST_DEDUCED_TYPENAME range_return<const ForwardRange,re>::type
+max_element(const ForwardRange& rng, BinaryPredicate pred)
+{
+ BOOST_RANGE_CONCEPT_ASSERT(( ForwardRangeConcept<const ForwardRange> ));
+ return range_return<const ForwardRange,re>::pack(
+ std::max_element(boost::begin(rng), boost::end(rng), pred),
+ rng);
+}
+
} // namespace range
using range::max_element;
} // namespace boost
Modified: trunk/boost/range/algorithm/min_element.hpp
==============================================================================
--- trunk/boost/range/algorithm/min_element.hpp (original)
+++ trunk/boost/range/algorithm/min_element.hpp 2010-04-22 18:43:57 EDT (Thu, 22 Apr 2010)
@@ -36,6 +36,15 @@
}
/// \overload
+template<class ForwardRange>
+inline BOOST_DEDUCED_TYPENAME range_iterator<const ForwardRange>::type
+min_element(const ForwardRange& rng)
+{
+ BOOST_RANGE_CONCEPT_ASSERT(( ForwardRangeConcept<const ForwardRange> ));
+ return std::min_element(boost::begin(rng), boost::end(rng));
+}
+
+/// \overload
template<class ForwardRange, class BinaryPredicate>
inline BOOST_DEDUCED_TYPENAME range_iterator<ForwardRange>::type
min_element(ForwardRange& rng, BinaryPredicate pred)
@@ -44,6 +53,15 @@
return std::min_element(boost::begin(rng), boost::end(rng), pred);
}
+/// \overload
+template<class ForwardRange, class BinaryPredicate>
+inline BOOST_DEDUCED_TYPENAME range_iterator<const ForwardRange>::type
+min_element(const ForwardRange& rng, BinaryPredicate pred)
+{
+ BOOST_RANGE_CONCEPT_ASSERT(( ForwardRangeConcept<const ForwardRange> ));
+ return std::min_element(boost::begin(rng), boost::end(rng), pred);
+}
+
// range_return overloads
/// \overload
@@ -58,6 +76,17 @@
}
/// \overload
+template<range_return_value re, class ForwardRange>
+inline BOOST_DEDUCED_TYPENAME range_return<const ForwardRange,re>::type
+min_element(const ForwardRange& rng)
+{
+ BOOST_RANGE_CONCEPT_ASSERT(( ForwardRangeConcept<const ForwardRange> ));
+ return range_return<const ForwardRange,re>::pack(
+ std::min_element(boost::begin(rng), boost::end(rng)),
+ rng);
+}
+
+/// \overload
template<range_return_value re, class ForwardRange, class BinaryPredicate>
inline BOOST_DEDUCED_TYPENAME range_return<ForwardRange,re>::type
min_element(ForwardRange& rng, BinaryPredicate pred)
@@ -68,6 +97,17 @@
rng);
}
+/// \overload
+template<range_return_value re, class ForwardRange, class BinaryPredicate>
+inline BOOST_DEDUCED_TYPENAME range_return<const ForwardRange,re>::type
+min_element(const ForwardRange& rng, BinaryPredicate pred)
+{
+ BOOST_RANGE_CONCEPT_ASSERT(( ForwardRangeConcept<const ForwardRange> ));
+ return range_return<const ForwardRange,re>::pack(
+ std::min_element(boost::begin(rng), boost::end(rng), pred),
+ rng);
+}
+
} // namespace range
using range::min_element;
} // namespace boost
Modified: trunk/boost/range/algorithm/mismatch.hpp
==============================================================================
--- trunk/boost/range/algorithm/mismatch.hpp (original)
+++ trunk/boost/range/algorithm/mismatch.hpp 2010-04-22 18:43:57 EDT (Thu, 22 Apr 2010)
@@ -71,6 +71,36 @@
template< class SinglePassRange1, class SinglePassRange2 >
inline std::pair<
BOOST_DEDUCED_TYPENAME range_iterator<SinglePassRange1>::type,
+ BOOST_DEDUCED_TYPENAME range_iterator<const SinglePassRange2>::type >
+mismatch(SinglePassRange1& rng1, const SinglePassRange2 & rng2)
+{
+ BOOST_RANGE_CONCEPT_ASSERT(( SinglePassRangeConcept<SinglePassRange1> ));
+ BOOST_RANGE_CONCEPT_ASSERT(( SinglePassRangeConcept<const SinglePassRange2> ));
+
+ return ::boost::range_detail::mismatch_impl(
+ ::boost::begin(rng1), ::boost::end(rng1),
+ ::boost::begin(rng2), ::boost::end(rng2));
+}
+
+/// \overload
+template< class SinglePassRange1, class SinglePassRange2 >
+inline std::pair<
+ BOOST_DEDUCED_TYPENAME range_iterator<const SinglePassRange1>::type,
+ BOOST_DEDUCED_TYPENAME range_iterator<const SinglePassRange2>::type >
+mismatch(const SinglePassRange1& rng1, const SinglePassRange2& rng2)
+{
+ BOOST_RANGE_CONCEPT_ASSERT(( SinglePassRangeConcept<const SinglePassRange1> ));
+ BOOST_RANGE_CONCEPT_ASSERT(( SinglePassRangeConcept<const SinglePassRange2> ));
+
+ return ::boost::range_detail::mismatch_impl(
+ ::boost::begin(rng1), ::boost::end(rng1),
+ ::boost::begin(rng2), ::boost::end(rng2));
+}
+
+/// \overload
+template< class SinglePassRange1, class SinglePassRange2 >
+inline std::pair<
+ BOOST_DEDUCED_TYPENAME range_iterator<SinglePassRange1>::type,
BOOST_DEDUCED_TYPENAME range_iterator<SinglePassRange2>::type >
mismatch(SinglePassRange1& rng1, SinglePassRange2 & rng2)
{
@@ -83,6 +113,52 @@
}
/// \overload
+template< class SinglePassRange1, class SinglePassRange2 >
+inline std::pair<
+ BOOST_DEDUCED_TYPENAME range_iterator<const SinglePassRange1>::type,
+ BOOST_DEDUCED_TYPENAME range_iterator<SinglePassRange2>::type >
+mismatch(const SinglePassRange1& rng1, SinglePassRange2& rng2)
+{
+ BOOST_RANGE_CONCEPT_ASSERT(( SinglePassRangeConcept<const SinglePassRange1> ));
+ BOOST_RANGE_CONCEPT_ASSERT(( SinglePassRangeConcept<SinglePassRange2> ));
+
+ return ::boost::range_detail::mismatch_impl(
+ ::boost::begin(rng1), ::boost::end(rng1),
+ ::boost::begin(rng2), ::boost::end(rng2));
+}
+
+
+/// \overload
+template< class SinglePassRange1, class SinglePassRange2, class BinaryPredicate >
+inline std::pair<
+ BOOST_DEDUCED_TYPENAME range_iterator<SinglePassRange1>::type,
+ BOOST_DEDUCED_TYPENAME range_iterator<const SinglePassRange2>::type >
+mismatch(SinglePassRange1& rng1, const SinglePassRange2& rng2, BinaryPredicate pred)
+{
+ BOOST_RANGE_CONCEPT_ASSERT(( SinglePassRangeConcept<SinglePassRange1> ));
+ BOOST_RANGE_CONCEPT_ASSERT(( SinglePassRangeConcept<const SinglePassRange2> ));
+
+ return ::boost::range_detail::mismatch_impl(
+ ::boost::begin(rng1), ::boost::end(rng1),
+ ::boost::begin(rng2), ::boost::end(rng2), pred);
+}
+
+/// \overload
+template< class SinglePassRange1, class SinglePassRange2, class BinaryPredicate >
+inline std::pair<
+ BOOST_DEDUCED_TYPENAME range_iterator<const SinglePassRange1>::type,
+ BOOST_DEDUCED_TYPENAME range_iterator<const SinglePassRange2>::type >
+mismatch(const SinglePassRange1& rng1, const SinglePassRange2& rng2, BinaryPredicate pred)
+{
+ BOOST_RANGE_CONCEPT_ASSERT(( SinglePassRangeConcept<const SinglePassRange1> ));
+ BOOST_RANGE_CONCEPT_ASSERT(( SinglePassRangeConcept<const SinglePassRange2> ));
+
+ return ::boost::range_detail::mismatch_impl(
+ ::boost::begin(rng1), ::boost::end(rng1),
+ ::boost::begin(rng2), ::boost::end(rng2), pred);
+}
+
+/// \overload
template< class SinglePassRange1, class SinglePassRange2, class BinaryPredicate >
inline std::pair<
BOOST_DEDUCED_TYPENAME range_iterator<SinglePassRange1>::type,
@@ -97,6 +173,21 @@
::boost::begin(rng2), ::boost::end(rng2), pred);
}
+/// \overload
+template< class SinglePassRange1, class SinglePassRange2, class BinaryPredicate >
+inline std::pair<
+ BOOST_DEDUCED_TYPENAME range_iterator<const SinglePassRange1>::type,
+ BOOST_DEDUCED_TYPENAME range_iterator<SinglePassRange2>::type >
+mismatch(const SinglePassRange1& rng1, SinglePassRange2& rng2, BinaryPredicate pred)
+{
+ BOOST_RANGE_CONCEPT_ASSERT(( SinglePassRangeConcept<const SinglePassRange1> ));
+ BOOST_RANGE_CONCEPT_ASSERT(( SinglePassRangeConcept<SinglePassRange2> ));
+
+ return ::boost::range_detail::mismatch_impl(
+ ::boost::begin(rng1), ::boost::end(rng1),
+ ::boost::begin(rng2), ::boost::end(rng2), pred);
+}
+
} // namespace range
using range::mismatch;
} // namespace boost
Modified: trunk/boost/range/algorithm/nth_element.hpp
==============================================================================
--- trunk/boost/range/algorithm/nth_element.hpp (original)
+++ trunk/boost/range/algorithm/nth_element.hpp 2010-04-22 18:43:57 EDT (Thu, 22 Apr 2010)
@@ -36,6 +36,16 @@
}
/// \overload
+template<class RandomAccessRange>
+inline const RandomAccessRange& nth_element(const RandomAccessRange& rng,
+ BOOST_DEDUCED_TYPENAME range_iterator<const RandomAccessRange>::type nth)
+{
+ BOOST_RANGE_CONCEPT_ASSERT(( RandomAccessRangeConcept<const RandomAccessRange> ));
+ std::nth_element(boost::begin(rng), nth, boost::end(rng));
+ return rng;
+}
+
+/// \overload
template<class RandomAccessRange, class BinaryPredicate>
inline RandomAccessRange& nth_element(RandomAccessRange& rng,
BOOST_DEDUCED_TYPENAME range_iterator<RandomAccessRange>::type nth,
@@ -46,6 +56,17 @@
return rng;
}
+/// \overload
+template<class RandomAccessRange, class BinaryPredicate>
+inline const RandomAccessRange& nth_element(const RandomAccessRange& rng,
+ BOOST_DEDUCED_TYPENAME range_iterator<const RandomAccessRange>::type nth,
+ BinaryPredicate sort_pred)
+{
+ BOOST_RANGE_CONCEPT_ASSERT(( RandomAccessRangeConcept<const RandomAccessRange> ));
+ std::nth_element(boost::begin(rng), nth, boost::end(rng), sort_pred);
+ return rng;
+}
+
} // namespace range
using range::nth_element;
} // namespace boost
Modified: trunk/boost/range/algorithm/permutation.hpp
==============================================================================
--- trunk/boost/range/algorithm/permutation.hpp (original)
+++ trunk/boost/range/algorithm/permutation.hpp 2010-04-22 18:43:57 EDT (Thu, 22 Apr 2010)
@@ -34,6 +34,14 @@
}
/// \overload
+template<class BidirectionalRange>
+inline bool next_permutation(const BidirectionalRange& rng)
+{
+ BOOST_RANGE_CONCEPT_ASSERT(( BidirectionalRangeConcept<const BidirectionalRange> ));
+ return std::next_permutation(boost::begin(rng), boost::end(rng));
+}
+
+/// \overload
template<class BidirectionalRange, class Compare>
inline bool next_permutation(BidirectionalRange& rng, Compare comp_pred)
{
@@ -42,6 +50,16 @@
comp_pred);
}
+/// \overload
+template<class BidirectionalRange, class Compare>
+inline bool next_permutation(const BidirectionalRange& rng,
+ Compare comp_pred)
+{
+ BOOST_RANGE_CONCEPT_ASSERT(( BidirectionalRangeConcept<const BidirectionalRange> ));
+ return std::next_permutation(boost::begin(rng), boost::end(rng),
+ comp_pred);
+}
+
/// \brief template function prev_permutation
///
/// range-based version of the prev_permutation std algorithm
@@ -56,6 +74,14 @@
}
/// \overload
+template<class BidirectionalRange>
+inline bool prev_permutation(const BidirectionalRange& rng)
+{
+ BOOST_RANGE_CONCEPT_ASSERT(( BidirectionalRangeConcept<const BidirectionalRange> ));
+ return std::prev_permutation(boost::begin(rng), boost::end(rng));
+}
+
+/// \overload
template<class BidirectionalRange, class Compare>
inline bool prev_permutation(BidirectionalRange& rng, Compare comp_pred)
{
@@ -64,6 +90,16 @@
comp_pred);
}
+/// \overload
+template<class BidirectionalRange, class Compare>
+inline bool prev_permutation(const BidirectionalRange& rng,
+ Compare comp_pred)
+{
+ BOOST_RANGE_CONCEPT_ASSERT(( BidirectionalRangeConcept<const BidirectionalRange> ));
+ return std::prev_permutation(boost::begin(rng), boost::end(rng),
+ comp_pred);
+}
+
} // namespace range
using range::next_permutation;
using range::prev_permutation;
Modified: trunk/boost/range/algorithm/search.hpp
==============================================================================
--- trunk/boost/range/algorithm/search.hpp (original)
+++ trunk/boost/range/algorithm/search.hpp 2010-04-22 18:43:57 EDT (Thu, 22 Apr 2010)
@@ -39,6 +39,17 @@
}
/// \overload
+template< class ForwardRange1, class ForwardRange2 >
+inline BOOST_DEDUCED_TYPENAME range_iterator<const ForwardRange1>::type
+search(const ForwardRange1& rng1, const ForwardRange2& rng2)
+{
+ BOOST_RANGE_CONCEPT_ASSERT(( ForwardRangeConcept<const ForwardRange1> ));
+ BOOST_RANGE_CONCEPT_ASSERT(( ForwardRangeConcept<const ForwardRange2> ));
+ return std::search(boost::begin(rng1), boost::end(rng1),
+ boost::begin(rng2), boost::end(rng2));
+}
+
+/// \overload
template< class ForwardRange1, class ForwardRange2, class BinaryPredicate >
inline BOOST_DEDUCED_TYPENAME range_iterator<ForwardRange1>::type
search(ForwardRange1& rng1, const ForwardRange2& rng2, BinaryPredicate pred)
@@ -49,6 +60,17 @@
boost::begin(rng2),boost::end(rng2),pred);
}
+/// \overload
+template< class ForwardRange1, class ForwardRange2, class BinaryPredicate >
+inline BOOST_DEDUCED_TYPENAME range_iterator<const ForwardRange1>::type
+search(const ForwardRange1& rng1, const ForwardRange2& rng2, BinaryPredicate pred)
+{
+ BOOST_RANGE_CONCEPT_ASSERT(( ForwardRangeConcept<const ForwardRange1> ));
+ BOOST_RANGE_CONCEPT_ASSERT(( ForwardRangeConcept<const ForwardRange2> ));
+ return std::search(boost::begin(rng1), boost::end(rng1),
+ boost::begin(rng2), boost::end(rng2), pred);
+}
+
// range_return overloads
/// \overload
@@ -65,6 +87,19 @@
}
/// \overload
+template< range_return_value re, class ForwardRange1, class ForwardRange2 >
+inline BOOST_DEDUCED_TYPENAME range_return<const ForwardRange1,re>::type
+search(const ForwardRange1& rng1, const ForwardRange2& rng2)
+{
+ BOOST_RANGE_CONCEPT_ASSERT(( ForwardRangeConcept<const ForwardRange1> ));
+ BOOST_RANGE_CONCEPT_ASSERT(( ForwardRangeConcept<const ForwardRange2> ));
+ return range_return<const ForwardRange1,re>::
+ pack(std::search(boost::begin(rng1),boost::end(rng1),
+ boost::begin(rng2),boost::end(rng2)),
+ rng1);
+}
+
+/// \overload
template< range_return_value re, class ForwardRange1, class ForwardRange2,
class BinaryPredicate >
inline BOOST_DEDUCED_TYPENAME range_return<ForwardRange1,re>::type
@@ -78,6 +113,20 @@
rng1);
}
+/// \overload
+template< range_return_value re, class ForwardRange1, class ForwardRange2,
+ class BinaryPredicate >
+inline BOOST_DEDUCED_TYPENAME range_return<const ForwardRange1,re>::type
+search(const ForwardRange1& rng1, const ForwardRange2& rng2, BinaryPredicate pred)
+{
+ BOOST_RANGE_CONCEPT_ASSERT(( ForwardRangeConcept<const ForwardRange1> ));
+ BOOST_RANGE_CONCEPT_ASSERT(( ForwardRangeConcept<const ForwardRange2> ));
+ return range_return<const ForwardRange1,re>::
+ pack(std::search(boost::begin(rng1),boost::end(rng1),
+ boost::begin(rng2),boost::end(rng2),pred),
+ rng1);
+}
+
} // namespace range
using range::search;
} // namespace boost
Modified: trunk/boost/range/algorithm/search_n.hpp
==============================================================================
--- trunk/boost/range/algorithm/search_n.hpp (original)
+++ trunk/boost/range/algorithm/search_n.hpp 2010-04-22 18:43:57 EDT (Thu, 22 Apr 2010)
@@ -40,6 +40,15 @@
}
/// \overload
+template< class ForwardRange, class Integer, class Value >
+inline BOOST_DEDUCED_TYPENAME range_iterator<const ForwardRange>::type
+search_n(const ForwardRange& rng, Integer count, const Value& value)
+{
+ BOOST_RANGE_CONCEPT_ASSERT((ForwardRangeConcept<ForwardRange>));
+ return std::search_n(boost::begin(rng), boost::end(rng), count, value);
+}
+
+/// \overload
template< class ForwardRange, class Integer, class Value,
class BinaryPredicate >
inline BOOST_DEDUCED_TYPENAME range_iterator<ForwardRange>::type
@@ -47,6 +56,22 @@
BinaryPredicate binary_pred)
{
BOOST_RANGE_CONCEPT_ASSERT((ForwardRangeConcept<ForwardRange>));
+ BOOST_RANGE_CONCEPT_ASSERT((BinaryPredicateConcept<BinaryPredicate,
+ BOOST_DEDUCED_TYPENAME range_value<ForwardRange>::type, const Value&>));
+ return std::search_n(boost::begin(rng), boost::end(rng),
+ count, value, binary_pred);
+}
+
+/// \overload
+template< class ForwardRange, class Integer, class Value,
+ class BinaryPredicate >
+inline BOOST_DEDUCED_TYPENAME range_iterator<const ForwardRange>::type
+search_n(const ForwardRange& rng, Integer count, const Value& value,
+ BinaryPredicate binary_pred)
+{
+ BOOST_RANGE_CONCEPT_ASSERT((ForwardRangeConcept<ForwardRange>));
+ BOOST_RANGE_CONCEPT_ASSERT((BinaryPredicateConcept<BinaryPredicate,
+ BOOST_DEDUCED_TYPENAME range_value<const ForwardRange>::type, const Value&>));
return std::search_n(boost::begin(rng), boost::end(rng),
count, value, binary_pred);
}
@@ -68,18 +93,51 @@
/// \overload
template< range_return_value re, class ForwardRange, class Integer,
+ class Value >
+inline BOOST_DEDUCED_TYPENAME range_return<const ForwardRange,re>::type
+search_n(const ForwardRange& rng, Integer count, const Value& value)
+{
+ BOOST_RANGE_CONCEPT_ASSERT((ForwardRangeConcept<ForwardRange>));
+ return range_return<const ForwardRange,re>::
+ pack(std::search_n(boost::begin(rng), boost::end(rng),
+ count, value),
+ rng);
+}
+
+/// \overload
+template< range_return_value re, class ForwardRange, class Integer,
class Value, class BinaryPredicate >
inline BOOST_DEDUCED_TYPENAME range_return<ForwardRange,re>::type
search_n(ForwardRange& rng, Integer count, const Value& value,
BinaryPredicate pred)
{
BOOST_RANGE_CONCEPT_ASSERT((ForwardRangeConcept<ForwardRange>));
+ BOOST_RANGE_CONCEPT_ASSERT((BinaryPredicateConcept<BinaryPredicate,
+ BOOST_DEDUCED_TYPENAME range_value<ForwardRange>::type,
+ const Value&>));
return range_return<ForwardRange,re>::
pack(std::search_n(boost::begin(rng), boost::end(rng),
count, value, pred),
rng);
}
+/// \overload
+template< range_return_value re, class ForwardRange, class Integer,
+ class Value, class BinaryPredicate >
+inline BOOST_DEDUCED_TYPENAME range_return<const ForwardRange,re>::type
+search_n(const ForwardRange& rng, Integer count, const Value& value,
+ BinaryPredicate pred)
+{
+ BOOST_RANGE_CONCEPT_ASSERT((ForwardRangeConcept<ForwardRange>));
+ BOOST_RANGE_CONCEPT_ASSERT((BinaryPredicateConcept<BinaryPredicate,
+ BOOST_DEDUCED_TYPENAME range_value<const ForwardRange>::type,
+ const Value&>));
+ return range_return<const ForwardRange,re>::
+ pack(std::search_n(boost::begin(rng), boost::end(rng),
+ count, value, pred),
+ rng);
+}
+
} // namespace range
using range::search_n;
} // namespace boost
Modified: trunk/boost/range/algorithm/stable_partition.hpp
==============================================================================
--- trunk/boost/range/algorithm/stable_partition.hpp (original)
+++ trunk/boost/range/algorithm/stable_partition.hpp 2010-04-22 18:43:57 EDT (Thu, 22 Apr 2010)
@@ -35,6 +35,15 @@
return std::stable_partition(boost::begin(rng), boost::end(rng), pred);
}
+/// \overload
+template<class BidirectionalRange, class UnaryPredicate>
+inline BOOST_DEDUCED_TYPENAME range_iterator<const BidirectionalRange>::type
+stable_partition(const BidirectionalRange& rng, UnaryPredicate pred)
+{
+ BOOST_RANGE_CONCEPT_ASSERT(( BidirectionalRangeConcept<const BidirectionalRange> ));
+ return std::stable_partition(boost::begin(rng),boost::end(rng),pred);
+}
+
// range_return overloads
template<range_return_value re, class BidirectionalRange, class UnaryPredicate>
inline BOOST_DEDUCED_TYPENAME range_return<BidirectionalRange,re>::type
@@ -46,6 +55,17 @@
rng);
}
+/// \overload
+template<range_return_value re, class BidirectionalRange, class UnaryPredicate>
+inline BOOST_DEDUCED_TYPENAME range_return<const BidirectionalRange,re>::type
+stable_partition(const BidirectionalRange& rng, UnaryPredicate pred)
+{
+ BOOST_RANGE_CONCEPT_ASSERT(( BidirectionalRangeConcept<const BidirectionalRange> ));
+ return range_return<const BidirectionalRange,re>::pack(
+ std::stable_partition(boost::begin(rng),boost::end(rng),pred),
+ rng);
+}
+
} // namespace range
using range::stable_partition;
} // namespace boost
Modified: trunk/boost/range/algorithm/unique.hpp
==============================================================================
--- trunk/boost/range/algorithm/unique.hpp (original)
+++ trunk/boost/range/algorithm/unique.hpp 2010-04-22 18:43:57 EDT (Thu, 22 Apr 2010)
@@ -37,6 +37,16 @@
}
/// \overload
+template< range_return_value re, class ForwardRange >
+inline BOOST_DEDUCED_TYPENAME range_return<const ForwardRange,re>::type
+unique( const ForwardRange& rng )
+{
+ BOOST_RANGE_CONCEPT_ASSERT(( ForwardRangeConcept<const ForwardRange> ));
+ return range_return<const ForwardRange,re>::
+ pack( std::unique( boost::begin(rng),
+ boost::end(rng)), rng );
+}
+/// \overload
template< range_return_value re, class ForwardRange, class BinaryPredicate >
inline BOOST_DEDUCED_TYPENAME range_return<ForwardRange,re>::type
unique( ForwardRange& rng, BinaryPredicate pred )
@@ -46,6 +56,16 @@
pack(std::unique(boost::begin(rng), boost::end(rng), pred),
rng);
}
+/// \overload
+template< range_return_value re, class ForwardRange, class BinaryPredicate >
+inline BOOST_DEDUCED_TYPENAME range_return<const ForwardRange,re>::type
+unique( const ForwardRange& rng, BinaryPredicate pred )
+{
+ BOOST_RANGE_CONCEPT_ASSERT(( ForwardRangeConcept<const ForwardRange> ));
+ return range_return<const ForwardRange,re>::
+ pack(std::unique(boost::begin(rng), boost::end(rng), pred),
+ rng);
+}
/// \overload
template< class ForwardRange >
@@ -56,6 +76,14 @@
return ::boost::range::unique<return_begin_found>(rng);
}
/// \overload
+template< class ForwardRange >
+inline BOOST_DEDUCED_TYPENAME range_return<const ForwardRange, return_begin_found>::type
+unique( const ForwardRange& rng )
+{
+ BOOST_RANGE_CONCEPT_ASSERT(( ForwardRangeConcept<const ForwardRange> ));
+ return ::boost::range::unique<return_begin_found>(rng);
+}
+/// \overload
template< class ForwardRange, class BinaryPredicate >
inline BOOST_DEDUCED_TYPENAME range_return<ForwardRange, return_begin_found>::type
unique( ForwardRange& rng, BinaryPredicate pred )
@@ -63,6 +91,14 @@
BOOST_RANGE_CONCEPT_ASSERT(( ForwardRangeConcept<ForwardRange> ));
return ::boost::range::unique<return_begin_found>(rng);
}
+/// \overload
+template< class ForwardRange, class BinaryPredicate >
+inline BOOST_DEDUCED_TYPENAME range_iterator<const ForwardRange>::type
+unique( const ForwardRange& rng, BinaryPredicate pred )
+{
+ BOOST_RANGE_CONCEPT_ASSERT(( ForwardRangeConcept<const ForwardRange> ));
+ return ::boost::range::unique<return_begin_found>(rng, pred);
+}
} // namespace range
using range::unique;
Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk