Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r63902 - in trunk/boost/range: adaptor algorithm algorithm_ext
From: neil_at_[hidden]
Date: 2010-07-11 20:08:45


Author: neilgroves
Date: 2010-07-11 20:08:41 EDT (Sun, 11 Jul 2010)
New Revision: 63902
URL: http://svn.boost.org/trac/boost/changeset/63902

Log:
[boost][range] - Improved handling of temporary ranges in range algorithms.
Text files modified:
   trunk/boost/range/adaptor/adjacent_filtered.hpp | 9 +++-
   trunk/boost/range/algorithm/copy.hpp | 2
   trunk/boost/range/algorithm/copy_backward.hpp | 2
   trunk/boost/range/algorithm/equal.hpp | 8 ++--
   trunk/boost/range/algorithm/fill.hpp | 9 +++++
   trunk/boost/range/algorithm/fill_n.hpp | 10 +++++
   trunk/boost/range/algorithm/find.hpp | 20 +++++++++++
   trunk/boost/range/algorithm/find_end.hpp | 53 +++++++++++++++++++++++++++++
   trunk/boost/range/algorithm/find_first_of.hpp | 54 ++++++++++++++++++++++++++++++
   trunk/boost/range/algorithm/find_if.hpp | 20 +++++++++++
   trunk/boost/range/algorithm/generate.hpp | 9 +++++
   trunk/boost/range/algorithm/heap_algorithm.hpp | 72 ++++++++++++++++++++++++++++++++++++++++
   trunk/boost/range/algorithm/lower_bound.hpp | 43 +++++++++++++++++++++++
   trunk/boost/range/algorithm/partial_sort.hpp | 22 ++++++++++++
   trunk/boost/range/algorithm/partial_sort_copy.hpp | 28 ++++++++++++++-
   trunk/boost/range/algorithm/partition.hpp | 20 +++++++++++
   trunk/boost/range/algorithm/random_shuffle.hpp | 18 ++++++++++
   trunk/boost/range/algorithm/remove.hpp | 20 +++++++++++
   trunk/boost/range/algorithm/remove_copy.hpp | 4 +-
   trunk/boost/range/algorithm/remove_copy_if.hpp | 4 +-
   trunk/boost/range/algorithm/remove_if.hpp | 20 +++++++++++
   trunk/boost/range/algorithm/replace.hpp | 11 ++++++
   trunk/boost/range/algorithm/replace_copy.hpp | 4 +-
   trunk/boost/range/algorithm/replace_copy_if.hpp | 4 +-
   trunk/boost/range/algorithm/replace_if.hpp | 11 ++++++
   trunk/boost/range/algorithm/reverse.hpp | 9 +++++
   trunk/boost/range/algorithm/reverse_copy.hpp | 2
   trunk/boost/range/algorithm/rotate.hpp | 10 +++++
   trunk/boost/range/algorithm/search_n.hpp | 8 ++--
   trunk/boost/range/algorithm/sort.hpp | 18 ++++++++++
   trunk/boost/range/algorithm/stable_sort.hpp | 18 ++++++++++
   trunk/boost/range/algorithm/swap_ranges.hpp | 45 +++++++++++++++++++++++++
   trunk/boost/range/algorithm/upper_bound.hpp | 43 +++++++++++++++++++++++
   trunk/boost/range/algorithm_ext/iota.hpp | 13 +++++++
   trunk/boost/range/algorithm_ext/is_sorted.hpp | 6 +-
   trunk/boost/range/algorithm_ext/overwrite.hpp | 27 +++++++++++++++
   36 files changed, 649 insertions(+), 27 deletions(-)

Modified: trunk/boost/range/adaptor/adjacent_filtered.hpp
==============================================================================
--- trunk/boost/range/adaptor/adjacent_filtered.hpp (original)
+++ trunk/boost/range/adaptor/adjacent_filtered.hpp 2010-07-11 20:08:41 EDT (Sun, 11 Jul 2010)
@@ -27,7 +27,6 @@
 
 namespace boost
 {
-
     namespace range_detail
     {
         template< class Iter, class Pred, bool default_pass >
@@ -140,10 +139,14 @@
 
         public:
             adjacent_filter_range( const P& p, R& r )
- : base_range( skip_iter( boost::begin(r), boost::end(r), p),
- skip_iter( boost::end(r), boost::end(r), p) )
+ : base_range(skip_iter(boost::begin(r), boost::end(r), p),
+ skip_iter(boost::end(r), boost::end(r), p))
             {
             }
+
+ private:
+ P m_pred;
+ R* m_range;
         };
 
         template< class T >

Modified: trunk/boost/range/algorithm/copy.hpp
==============================================================================
--- trunk/boost/range/algorithm/copy.hpp (original)
+++ trunk/boost/range/algorithm/copy.hpp 2010-07-11 20:08:41 EDT (Sun, 11 Jul 2010)
@@ -30,7 +30,7 @@
 template< class SinglePassRange, class OutputIterator >
 inline OutputIterator copy(const SinglePassRange& rng, OutputIterator out)
 {
- BOOST_RANGE_CONCEPT_ASSERT(( SinglePassRangeConcept<SinglePassRange> ));
+ BOOST_RANGE_CONCEPT_ASSERT(( SinglePassRangeConcept<const SinglePassRange> ));
     return std::copy(boost::begin(rng),boost::end(rng),out);
 }
 

Modified: trunk/boost/range/algorithm/copy_backward.hpp
==============================================================================
--- trunk/boost/range/algorithm/copy_backward.hpp (original)
+++ trunk/boost/range/algorithm/copy_backward.hpp 2010-07-11 20:08:41 EDT (Sun, 11 Jul 2010)
@@ -32,7 +32,7 @@
 copy_backward(const BidirectionalRange& rng,
               BidirectionalTraversalWriteableIterator out)
 {
- BOOST_RANGE_CONCEPT_ASSERT(( BidirectionalRangeConcept<BidirectionalRange> ));
+ BOOST_RANGE_CONCEPT_ASSERT(( BidirectionalRangeConcept<const BidirectionalRange> ));
     return std::copy_backward(boost::begin(rng), boost::end(rng), out);
 }
 

Modified: trunk/boost/range/algorithm/equal.hpp
==============================================================================
--- trunk/boost/range/algorithm/equal.hpp (original)
+++ trunk/boost/range/algorithm/equal.hpp 2010-07-11 20:08:41 EDT (Sun, 11 Jul 2010)
@@ -159,8 +159,8 @@
         template< class SinglePassRange1, class SinglePassRange2 >
         inline bool equal( const SinglePassRange1& rng1, const SinglePassRange2& rng2 )
         {
- BOOST_RANGE_CONCEPT_ASSERT(( SinglePassRangeConcept<SinglePassRange1> ));
- BOOST_RANGE_CONCEPT_ASSERT(( SinglePassRangeConcept<SinglePassRange2> ));
+ BOOST_RANGE_CONCEPT_ASSERT(( SinglePassRangeConcept<const SinglePassRange1> ));
+ BOOST_RANGE_CONCEPT_ASSERT(( SinglePassRangeConcept<const SinglePassRange2> ));
 
             return ::boost::range_detail::equal(
                 ::boost::begin(rng1), ::boost::end(rng1),
@@ -172,8 +172,8 @@
         inline bool equal( const SinglePassRange1& rng1, const SinglePassRange2& rng2,
                            BinaryPredicate pred )
         {
- BOOST_RANGE_CONCEPT_ASSERT(( SinglePassRangeConcept<SinglePassRange1> ));
- BOOST_RANGE_CONCEPT_ASSERT(( SinglePassRangeConcept<SinglePassRange2> ));
+ BOOST_RANGE_CONCEPT_ASSERT(( SinglePassRangeConcept<const SinglePassRange1> ));
+ BOOST_RANGE_CONCEPT_ASSERT(( SinglePassRangeConcept<const SinglePassRange2> ));
 
             return ::boost::range_detail::equal(
                 ::boost::begin(rng1), ::boost::end(rng1),

Modified: trunk/boost/range/algorithm/fill.hpp
==============================================================================
--- trunk/boost/range/algorithm/fill.hpp (original)
+++ trunk/boost/range/algorithm/fill.hpp 2010-07-11 20:08:41 EDT (Sun, 11 Jul 2010)
@@ -33,6 +33,15 @@
     return rng;
 }
 
+/// \overload
+template< class ForwardRange, class Value >
+inline const ForwardRange& fill(const ForwardRange& rng, const Value& val)
+{
+ BOOST_RANGE_CONCEPT_ASSERT(( ForwardRangeConcept<const ForwardRange> ));
+ std::fill(boost::begin(rng), boost::end(rng), val);
+ return rng;
+}
+
     } // namespace range
     using range::fill;
 }

Modified: trunk/boost/range/algorithm/fill_n.hpp
==============================================================================
--- trunk/boost/range/algorithm/fill_n.hpp (original)
+++ trunk/boost/range/algorithm/fill_n.hpp 2010-07-11 20:08:41 EDT (Sun, 11 Jul 2010)
@@ -36,6 +36,16 @@
     return rng;
 }
 
+/// \overload
+template< class ForwardRange, class Size, class Value >
+inline const ForwardRange& fill_n(const ForwardRange& rng, Size n, const Value& val)
+{
+ BOOST_RANGE_CONCEPT_ASSERT(( ForwardRangeConcept<const ForwardRange> ));
+ BOOST_ASSERT( static_cast<Size>(std::distance(boost::begin(rng), boost::end(rng))) >= n );
+ std::fill_n(boost::begin(rng), n, val);
+ return rng;
+}
+
     } // namespace range
     using range::fill_n;
 } // namespace boost

Modified: trunk/boost/range/algorithm/find.hpp
==============================================================================
--- trunk/boost/range/algorithm/find.hpp (original)
+++ trunk/boost/range/algorithm/find.hpp 2010-07-11 20:08:41 EDT (Sun, 11 Jul 2010)
@@ -34,6 +34,15 @@
     return std::find(boost::begin(rng), boost::end(rng), val);
 }
 
+/// \overload
+template< class SinglePassRange, class Value >
+inline BOOST_DEDUCED_TYPENAME range_iterator<const SinglePassRange>::type
+find( const SinglePassRange& rng, const Value& val )
+{
+ BOOST_RANGE_CONCEPT_ASSERT(( SinglePassRangeConcept<const SinglePassRange> ));
+ return std::find(boost::begin(rng), boost::end(rng), val);
+}
+
 // range_return overloads
 
 /// \overload
@@ -47,6 +56,17 @@
              rng);
 }
 
+/// \overload
+template< range_return_value re, class SinglePassRange, class Value >
+inline BOOST_DEDUCED_TYPENAME range_return<const SinglePassRange,re>::type
+find( const SinglePassRange& rng, const Value& val )
+{
+ BOOST_RANGE_CONCEPT_ASSERT(( SinglePassRangeConcept<const SinglePassRange> ));
+ return range_return<const SinglePassRange,re>::
+ pack(std::find(boost::begin(rng), boost::end(rng), val),
+ rng);
+}
+
     } // namespace range
     using range::find;
 }

Modified: trunk/boost/range/algorithm/find_end.hpp
==============================================================================
--- trunk/boost/range/algorithm/find_end.hpp (original)
+++ trunk/boost/range/algorithm/find_end.hpp 2010-07-11 20:08:41 EDT (Sun, 11 Jul 2010)
@@ -40,6 +40,18 @@
 }
 
 /// \overload
+template< class ForwardRange1, class ForwardRange2 >
+inline BOOST_DEDUCED_TYPENAME range_iterator< const ForwardRange1 >::type
+find_end(const ForwardRange1 & rng1, const ForwardRange2& rng2)
+{
+ BOOST_RANGE_CONCEPT_ASSERT(( ForwardRangeConcept<const ForwardRange1> ));
+ BOOST_RANGE_CONCEPT_ASSERT(( ForwardRangeConcept<const ForwardRange2> ));
+
+ return std::find_end(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
 find_end(ForwardRange1 & rng1, const ForwardRange2& rng2, BinaryPredicate pred)
@@ -52,6 +64,18 @@
 }
 
 /// \overload
+template< class ForwardRange1, class ForwardRange2, class BinaryPredicate >
+inline BOOST_DEDUCED_TYPENAME range_iterator<const ForwardRange1>::type
+find_end(const ForwardRange1& rng1, const ForwardRange2& rng2, BinaryPredicate pred)
+{
+ BOOST_RANGE_CONCEPT_ASSERT(( ForwardRangeConcept<const ForwardRange1> ));
+ BOOST_RANGE_CONCEPT_ASSERT(( ForwardRangeConcept<const ForwardRange2> ));
+
+ return std::find_end(boost::begin(rng1),boost::end(rng1),
+ boost::begin(rng2),boost::end(rng2),pred);
+}
+
+/// \overload
 template< range_return_value re, class ForwardRange1, class ForwardRange2 >
 inline BOOST_DEDUCED_TYPENAME range_return<ForwardRange1,re>::type
 find_end(ForwardRange1& rng1, const ForwardRange2& rng2)
@@ -66,6 +90,20 @@
 }
 
 /// \overload
+template< range_return_value re, class ForwardRange1, class ForwardRange2 >
+inline BOOST_DEDUCED_TYPENAME range_return<const ForwardRange1,re>::type
+find_end(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::find_end(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
@@ -80,6 +118,21 @@
              rng1);
 }
 
+/// \overload
+template< range_return_value re, class ForwardRange1, class ForwardRange2,
+ class BinaryPredicate >
+inline BOOST_DEDUCED_TYPENAME range_return<const ForwardRange1,re>::type
+find_end(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::find_end(boost::begin(rng1), boost::end(rng1),
+ boost::begin(rng2), boost::end(rng2), pred),
+ rng1);
+}
+
     } // namespace range
     using range::find_end;
 } // namespace boost

Modified: trunk/boost/range/algorithm/find_first_of.hpp
==============================================================================
--- trunk/boost/range/algorithm/find_first_of.hpp (original)
+++ trunk/boost/range/algorithm/find_first_of.hpp 2010-07-11 20:08:41 EDT (Sun, 11 Jul 2010)
@@ -40,6 +40,18 @@
 }
 
 /// \overload
+template< class SinglePassRange1, class ForwardRange2 >
+inline BOOST_DEDUCED_TYPENAME range_iterator<const SinglePassRange1>::type
+find_first_of(const SinglePassRange1& rng1, const ForwardRange2& rng2)
+{
+ BOOST_RANGE_CONCEPT_ASSERT(( SinglePassRangeConcept<const SinglePassRange1> ));
+ BOOST_RANGE_CONCEPT_ASSERT(( ForwardRangeConcept<const ForwardRange2> ));
+
+ return std::find_first_of(boost::begin(rng1),boost::end(rng1),
+ boost::begin(rng2),boost::end(rng2));
+}
+
+/// \overload
 template< class SinglePassRange1, class ForwardRange2, class BinaryPredicate >
 inline BOOST_DEDUCED_TYPENAME range_iterator<SinglePassRange1>::type
 find_first_of(SinglePassRange1 & rng1, ForwardRange2 const & rng2, BinaryPredicate pred)
@@ -51,6 +63,18 @@
                               boost::begin(rng2),boost::end(rng2),pred);
 }
 
+/// \overload
+template< class SinglePassRange1, class ForwardRange2, class BinaryPredicate >
+inline BOOST_DEDUCED_TYPENAME range_iterator<const SinglePassRange1>::type
+find_first_of(const SinglePassRange1& rng1, const ForwardRange2& rng2, BinaryPredicate pred)
+{
+ BOOST_RANGE_CONCEPT_ASSERT(( SinglePassRangeConcept<const SinglePassRange1> ));
+ BOOST_RANGE_CONCEPT_ASSERT(( ForwardRangeConcept<const ForwardRange2> ));
+
+ return std::find_first_of(boost::begin(rng1),boost::end(rng1),
+ boost::begin(rng2),boost::end(rng2),pred);
+}
+
 // range return overloads
 /// \overload
 template< range_return_value re, class SinglePassRange1, class ForwardRange2 >
@@ -67,6 +91,20 @@
 }
 
 /// \overload
+template< range_return_value re, class SinglePassRange1, class ForwardRange2 >
+inline BOOST_DEDUCED_TYPENAME range_return<const SinglePassRange1,re>::type
+find_first_of(const SinglePassRange1& rng1, const ForwardRange2& rng2)
+{
+ BOOST_RANGE_CONCEPT_ASSERT(( SinglePassRangeConcept<const SinglePassRange1> ));
+ BOOST_RANGE_CONCEPT_ASSERT(( ForwardRangeConcept<const ForwardRange2> ));
+
+ return range_return<const SinglePassRange1,re>::
+ pack(std::find_first_of(boost::begin(rng1), boost::end(rng1),
+ boost::begin(rng2), boost::end(rng2)),
+ rng1);
+}
+
+/// \overload
 template< range_return_value re, class SinglePassRange1, class ForwardRange2,
           class BinaryPredicate >
 inline BOOST_DEDUCED_TYPENAME range_return<SinglePassRange1,re>::type
@@ -82,6 +120,22 @@
              rng1);
 }
 
+/// \overload
+template< range_return_value re, class SinglePassRange1, class ForwardRange2,
+ class BinaryPredicate >
+inline BOOST_DEDUCED_TYPENAME range_return<const SinglePassRange1,re>::type
+find_first_of(const SinglePassRange1 & rng1, const ForwardRange2& rng2,
+ BinaryPredicate pred)
+{
+ BOOST_RANGE_CONCEPT_ASSERT(( SinglePassRangeConcept<const SinglePassRange1> ));
+ BOOST_RANGE_CONCEPT_ASSERT(( ForwardRangeConcept<const ForwardRange2> ));
+
+ return range_return<const SinglePassRange1,re>::
+ pack(std::find_first_of(boost::begin(rng1), boost::end(rng1),
+ boost::begin(rng2), boost::end(rng2), pred),
+ rng1);
+}
+
     } // namespace range
     using range::find_first_of;
 } // namespace boost

Modified: trunk/boost/range/algorithm/find_if.hpp
==============================================================================
--- trunk/boost/range/algorithm/find_if.hpp (original)
+++ trunk/boost/range/algorithm/find_if.hpp 2010-07-11 20:08:41 EDT (Sun, 11 Jul 2010)
@@ -35,6 +35,15 @@
     return std::find_if(boost::begin(rng), boost::end(rng), pred);
 }
 
+/// \overload
+template< class SinglePassRange, class UnaryPredicate >
+inline BOOST_DEDUCED_TYPENAME range_iterator<const SinglePassRange>::type
+find_if( const SinglePassRange& rng, UnaryPredicate pred )
+{
+ BOOST_RANGE_CONCEPT_ASSERT(( SinglePassRangeConcept<const SinglePassRange> ));
+ return std::find_if(boost::begin(rng), boost::end(rng), pred);
+}
+
 // range_return overloads
 
 /// \overload
@@ -48,6 +57,17 @@
              rng);
 }
 
+/// \overload
+template< range_return_value re, class SinglePassRange, class UnaryPredicate >
+inline BOOST_DEDUCED_TYPENAME range_return<const SinglePassRange,re>::type
+find_if( const SinglePassRange& rng, UnaryPredicate pred )
+{
+ BOOST_RANGE_CONCEPT_ASSERT(( SinglePassRangeConcept<const SinglePassRange> ));
+ return range_return<const SinglePassRange,re>::
+ pack(std::find_if(boost::begin(rng), boost::end(rng), pred),
+ rng);
+}
+
     } // namespace range
     using range::find_if;
 } // namespace boost

Modified: trunk/boost/range/algorithm/generate.hpp
==============================================================================
--- trunk/boost/range/algorithm/generate.hpp (original)
+++ trunk/boost/range/algorithm/generate.hpp 2010-07-11 20:08:41 EDT (Sun, 11 Jul 2010)
@@ -33,6 +33,15 @@
     return rng;
 }
 
+/// \overload
+template< class ForwardRange, class Generator >
+inline const ForwardRange& generate( const ForwardRange& rng, Generator gen )
+{
+ BOOST_RANGE_CONCEPT_ASSERT(( ForwardRangeConcept<const ForwardRange> ));
+ std::generate(boost::begin(rng), boost::end(rng), gen);
+ return rng;
+}
+
     } // namespace range
     using range::generate;
 } // namespace boost

Modified: trunk/boost/range/algorithm/heap_algorithm.hpp
==============================================================================
--- trunk/boost/range/algorithm/heap_algorithm.hpp (original)
+++ trunk/boost/range/algorithm/heap_algorithm.hpp 2010-07-11 20:08:41 EDT (Sun, 11 Jul 2010)
@@ -35,6 +35,15 @@
 }
 
 /// \overload
+template<class RandomAccessRange>
+inline const RandomAccessRange& push_heap(const RandomAccessRange& rng)
+{
+ BOOST_RANGE_CONCEPT_ASSERT(( RandomAccessRangeConcept<const RandomAccessRange> ));
+ std::push_heap(boost::begin(rng), boost::end(rng));
+ return rng;
+}
+
+/// \overload
 template<class RandomAccessRange, class Compare>
 inline RandomAccessRange& push_heap(RandomAccessRange& rng, Compare comp_pred)
 {
@@ -43,6 +52,15 @@
     return rng;
 }
 
+/// \overload
+template<class RandomAccessRange, class Compare>
+inline const RandomAccessRange& push_heap(const RandomAccessRange& rng, Compare comp_pred)
+{
+ BOOST_RANGE_CONCEPT_ASSERT(( RandomAccessRangeConcept<const RandomAccessRange> ));
+ std::push_heap(boost::begin(rng), boost::end(rng), comp_pred);
+ return rng;
+}
+
 /// \brief template function pop_heap
 ///
 /// range-based version of the pop_heap std algorithm
@@ -58,6 +76,15 @@
 }
 
 /// \overload
+template<class RandomAccessRange>
+inline const RandomAccessRange& pop_heap(const RandomAccessRange& rng)
+{
+ BOOST_RANGE_CONCEPT_ASSERT(( RandomAccessRangeConcept<const RandomAccessRange> ));
+ std::pop_heap(boost::begin(rng), boost::end(rng));
+ return rng;
+}
+
+/// \overload
 template<class RandomAccessRange, class Compare>
 inline RandomAccessRange& pop_heap(RandomAccessRange& rng, Compare comp_pred)
 {
@@ -66,6 +93,15 @@
     return rng;
 }
 
+/// \overload
+template<class RandomAccessRange, class Compare>
+inline const RandomAccessRange& pop_heap(const RandomAccessRange& rng, Compare comp_pred)
+{
+ BOOST_RANGE_CONCEPT_ASSERT(( RandomAccessRangeConcept<const RandomAccessRange> ));
+ std::pop_heap(boost::begin(rng), boost::end(rng), comp_pred);
+ return rng;
+}
+
 /// \brief template function make_heap
 ///
 /// range-based version of the make_heap std algorithm
@@ -81,6 +117,15 @@
 }
 
 /// \overload
+template<class RandomAccessRange>
+inline const RandomAccessRange& make_heap(const RandomAccessRange& rng)
+{
+ BOOST_RANGE_CONCEPT_ASSERT(( RandomAccessRangeConcept<const RandomAccessRange> ));
+ std::make_heap(boost::begin(rng), boost::end(rng));
+ return rng;
+}
+
+/// \overload
 template<class RandomAccessRange, class Compare>
 inline RandomAccessRange& make_heap(RandomAccessRange& rng, Compare comp_pred)
 {
@@ -89,6 +134,15 @@
     return rng;
 }
 
+/// \overload
+template<class RandomAccessRange, class Compare>
+inline const RandomAccessRange& make_heap(const RandomAccessRange& rng, Compare comp_pred)
+{
+ BOOST_RANGE_CONCEPT_ASSERT(( RandomAccessRangeConcept<const RandomAccessRange> ));
+ std::make_heap(boost::begin(rng), boost::end(rng), comp_pred);
+ return rng;
+}
+
 /// \brief template function sort_heap
 ///
 /// range-based version of the sort_heap std algorithm
@@ -104,6 +158,15 @@
 }
 
 /// \overload
+template<class RandomAccessRange>
+inline const RandomAccessRange& sort_heap(const RandomAccessRange& rng)
+{
+ BOOST_RANGE_CONCEPT_ASSERT(( RandomAccessRangeConcept<const RandomAccessRange> ));
+ std::sort_heap(boost::begin(rng), boost::end(rng));
+ return rng;
+}
+
+/// \overload
 template<class RandomAccessRange, class Compare>
 inline RandomAccessRange& sort_heap(RandomAccessRange& rng, Compare comp_pred)
 {
@@ -112,6 +175,15 @@
     return rng;
 }
 
+/// \overload
+template<class RandomAccessRange, class Compare>
+inline const RandomAccessRange& sort_heap(const RandomAccessRange& rng, Compare comp_pred)
+{
+ BOOST_RANGE_CONCEPT_ASSERT(( RandomAccessRangeConcept<const RandomAccessRange> ));
+ std::sort_heap(boost::begin(rng), boost::end(rng), comp_pred);
+ return rng;
+}
+
     } // namespace range
     using range::push_heap;
     using range::pop_heap;

Modified: trunk/boost/range/algorithm/lower_bound.hpp
==============================================================================
--- trunk/boost/range/algorithm/lower_bound.hpp (original)
+++ trunk/boost/range/algorithm/lower_bound.hpp 2010-07-11 20:08:41 EDT (Sun, 11 Jul 2010)
@@ -33,6 +33,16 @@
     BOOST_RANGE_CONCEPT_ASSERT(( ForwardRangeConcept<ForwardRange> ));
     return std::lower_bound(boost::begin(rng), boost::end(rng), val);
 }
+
+/// \overload
+template< class ForwardRange, class Value >
+inline BOOST_DEDUCED_TYPENAME range_iterator<const ForwardRange>::type
+lower_bound( const ForwardRange& rng, Value val )
+{
+ BOOST_RANGE_CONCEPT_ASSERT(( ForwardRangeConcept<const ForwardRange> ));
+ return std::lower_bound(boost::begin(rng), boost::end(rng), val);
+}
+
 /// \overload
 template< class ForwardRange, class Value, class SortPredicate >
 inline BOOST_DEDUCED_TYPENAME range_iterator<ForwardRange>::type
@@ -41,6 +51,16 @@
     BOOST_RANGE_CONCEPT_ASSERT(( ForwardRangeConcept<ForwardRange> ));
     return std::lower_bound(boost::begin(rng), boost::end(rng), val, pred);
 }
+
+/// \overload
+template< class ForwardRange, class Value, class SortPredicate >
+inline BOOST_DEDUCED_TYPENAME range_iterator<const ForwardRange>::type
+lower_bound( const ForwardRange& rng, Value val, SortPredicate pred )
+{
+ BOOST_RANGE_CONCEPT_ASSERT(( ForwardRangeConcept<const ForwardRange> ));
+ return std::lower_bound(boost::begin(rng), boost::end(rng), val, pred);
+}
+
 /// \overload
 template< range_return_value re, class ForwardRange, class Value >
 inline BOOST_DEDUCED_TYPENAME range_return<ForwardRange,re>::type
@@ -51,6 +71,18 @@
         pack(std::lower_bound(boost::begin(rng), boost::end(rng), val),
              rng);
 }
+
+/// \overload
+template< range_return_value re, class ForwardRange, class Value >
+inline BOOST_DEDUCED_TYPENAME range_return<const ForwardRange,re>::type
+lower_bound( const ForwardRange& rng, Value val )
+{
+ BOOST_RANGE_CONCEPT_ASSERT(( ForwardRangeConcept<const ForwardRange> ));
+ return range_return<const ForwardRange,re>::
+ pack(std::lower_bound(boost::begin(rng), boost::end(rng), val),
+ rng);
+}
+
 /// \overload
 template< range_return_value re, class ForwardRange, class Value, class SortPredicate >
 inline BOOST_DEDUCED_TYPENAME range_return<ForwardRange,re>::type
@@ -62,6 +94,17 @@
              rng);
 }
 
+/// \overload
+template< range_return_value re, class ForwardRange, class Value, class SortPredicate >
+inline BOOST_DEDUCED_TYPENAME range_return<const ForwardRange,re>::type
+lower_bound( const ForwardRange& rng, Value val, SortPredicate pred )
+{
+ BOOST_RANGE_CONCEPT_ASSERT(( ForwardRangeConcept<const ForwardRange> ));
+ return range_return<const ForwardRange,re>::
+ pack(std::lower_bound(boost::begin(rng), boost::end(rng), val, pred),
+ rng);
+}
+
     } // namespace range
     using range::lower_bound;
 } // namespace boost

Modified: trunk/boost/range/algorithm/partial_sort.hpp
==============================================================================
--- trunk/boost/range/algorithm/partial_sort.hpp (original)
+++ trunk/boost/range/algorithm/partial_sort.hpp 2010-07-11 20:08:41 EDT (Sun, 11 Jul 2010)
@@ -36,6 +36,16 @@
 }
 
 /// \overload
+template<class RandomAccessRange>
+inline const RandomAccessRange& partial_sort(const RandomAccessRange& rng,
+ BOOST_DEDUCED_TYPENAME range_iterator<const RandomAccessRange>::type middle)
+{
+ BOOST_RANGE_CONCEPT_ASSERT(( RandomAccessRangeConcept<const RandomAccessRange> ));
+ std::partial_sort(boost::begin(rng), middle, boost::end(rng));
+ return rng;
+}
+
+/// \overload
 template<class RandomAccessRange, class BinaryPredicate>
 inline RandomAccessRange& partial_sort(RandomAccessRange& rng,
     BOOST_DEDUCED_TYPENAME range_iterator<RandomAccessRange>::type middle,
@@ -47,6 +57,18 @@
     return rng;
 }
 
+/// \overload
+template<class RandomAccessRange, class BinaryPredicate>
+inline const RandomAccessRange& partial_sort(const RandomAccessRange& rng,
+ BOOST_DEDUCED_TYPENAME range_iterator<const RandomAccessRange>::type middle,
+ BinaryPredicate sort_pred)
+{
+ BOOST_RANGE_CONCEPT_ASSERT(( RandomAccessRangeConcept<const RandomAccessRange> ));
+ std::partial_sort(boost::begin(rng), middle, boost::end(rng),
+ sort_pred);
+ return rng;
+}
+
     } // namespace range
     using range::partial_sort;
 } // namespace boost

Modified: trunk/boost/range/algorithm/partial_sort_copy.hpp
==============================================================================
--- trunk/boost/range/algorithm/partial_sort_copy.hpp (original)
+++ trunk/boost/range/algorithm/partial_sort_copy.hpp 2010-07-11 20:08:41 EDT (Sun, 11 Jul 2010)
@@ -32,7 +32,18 @@
 inline BOOST_DEDUCED_TYPENAME range_iterator<RandomAccessRange>::type
 partial_sort_copy(const SinglePassRange& rng1, RandomAccessRange& rng2)
 {
- BOOST_RANGE_CONCEPT_ASSERT((SinglePassRangeConcept<SinglePassRange>));
+ BOOST_RANGE_CONCEPT_ASSERT((SinglePassRangeConcept<const SinglePassRange>));
+
+ return std::partial_sort_copy(boost::begin(rng1), boost::end(rng1),
+ boost::begin(rng2), boost::end(rng2));
+}
+
+/// \overload
+template<class SinglePassRange, class RandomAccessRange>
+inline BOOST_DEDUCED_TYPENAME range_iterator<RandomAccessRange>::type
+partial_sort_copy(const SinglePassRange& rng1, const RandomAccessRange& rng2)
+{
+ BOOST_RANGE_CONCEPT_ASSERT((SinglePassRangeConcept<const SinglePassRange>));
 
     return std::partial_sort_copy(boost::begin(rng1), boost::end(rng1),
         boost::begin(rng2), boost::end(rng2));
@@ -45,7 +56,20 @@
 partial_sort_copy(const SinglePassRange& rng1, RandomAccessRange& rng2,
     BinaryPredicate pred)
 {
- BOOST_RANGE_CONCEPT_ASSERT((SinglePassRangeConcept<SinglePassRange>));
+ BOOST_RANGE_CONCEPT_ASSERT((SinglePassRangeConcept<const SinglePassRange>));
+
+ return std::partial_sort_copy(boost::begin(rng1), boost::end(rng1),
+ boost::begin(rng2), boost::end(rng2), pred);
+}
+
+/// \overload
+template<class SinglePassRange, class RandomAccessRange,
+ class BinaryPredicate>
+inline BOOST_DEDUCED_TYPENAME range_iterator<const RandomAccessRange>::type
+partial_sort_copy(const SinglePassRange& rng1, const RandomAccessRange& rng2,
+ BinaryPredicate pred)
+{
+ BOOST_RANGE_CONCEPT_ASSERT((SinglePassRangeConcept<const SinglePassRange>));
 
     return std::partial_sort_copy(boost::begin(rng1), boost::end(rng1),
         boost::begin(rng2), boost::end(rng2), pred);

Modified: trunk/boost/range/algorithm/partition.hpp
==============================================================================
--- trunk/boost/range/algorithm/partition.hpp (original)
+++ trunk/boost/range/algorithm/partition.hpp 2010-07-11 20:08:41 EDT (Sun, 11 Jul 2010)
@@ -34,6 +34,15 @@
     return std::partition(boost::begin(rng),boost::end(rng),pred);
 }
 
+/// \overload
+template<class ForwardRange, class UnaryPredicate>
+inline BOOST_DEDUCED_TYPENAME range_iterator<ForwardRange>::type
+partition(const ForwardRange& rng, UnaryPredicate pred)
+{
+ BOOST_RANGE_CONCEPT_ASSERT(( ForwardRangeConcept<const ForwardRange> ));
+ return std::partition(boost::begin(rng),boost::end(rng),pred);
+}
+
 // range_return overloads
 
 /// \overload
@@ -47,6 +56,17 @@
         pack(std::partition(boost::begin(rng), boost::end(rng), pred), rng);
 }
 
+/// \overload
+template< range_return_value re, class ForwardRange,
+ class UnaryPredicate >
+inline BOOST_DEDUCED_TYPENAME range_return<const ForwardRange,re>::type
+partition(const ForwardRange& rng, UnaryPredicate pred)
+{
+ BOOST_RANGE_CONCEPT_ASSERT(( ForwardRangeConcept<const ForwardRange> ));
+ return boost::range_return<const ForwardRange,re>::
+ pack(std::partition(boost::begin(rng), boost::end(rng), pred), rng);
+}
+
     } // namespace range
     using range::partition;
 } // namespace boost

Modified: trunk/boost/range/algorithm/random_shuffle.hpp
==============================================================================
--- trunk/boost/range/algorithm/random_shuffle.hpp (original)
+++ trunk/boost/range/algorithm/random_shuffle.hpp 2010-07-11 20:08:41 EDT (Sun, 11 Jul 2010)
@@ -35,6 +35,15 @@
 }
 
 /// \overload
+template<class RandomAccessRange>
+inline const RandomAccessRange& random_shuffle(const RandomAccessRange& rng)
+{
+ BOOST_RANGE_CONCEPT_ASSERT(( RandomAccessRangeConcept<const RandomAccessRange> ));
+ std::random_shuffle(boost::begin(rng), boost::end(rng));
+ return rng;
+}
+
+/// \overload
 template<class RandomAccessRange, class Generator>
 inline RandomAccessRange& random_shuffle(RandomAccessRange& rng, Generator& gen)
 {
@@ -43,6 +52,15 @@
     return rng;
 }
 
+/// \overload
+template<class RandomAccessRange, class Generator>
+inline const RandomAccessRange& random_shuffle(const RandomAccessRange& rng, Generator& gen)
+{
+ BOOST_RANGE_CONCEPT_ASSERT(( RandomAccessRangeConcept<const RandomAccessRange> ));
+ std::random_shuffle(boost::begin(rng), boost::end(rng), gen);
+ return rng;
+}
+
     } // namespace range
     using range::random_shuffle;
 } // namespace boost

Modified: trunk/boost/range/algorithm/remove.hpp
==============================================================================
--- trunk/boost/range/algorithm/remove.hpp (original)
+++ trunk/boost/range/algorithm/remove.hpp 2010-07-11 20:08:41 EDT (Sun, 11 Jul 2010)
@@ -34,6 +34,15 @@
     return std::remove(boost::begin(rng),boost::end(rng),val);
 }
 
+/// \overload
+template< class ForwardRange, class Value >
+inline BOOST_DEDUCED_TYPENAME range_iterator<const ForwardRange>::type
+remove(const ForwardRange& rng, const Value& val)
+{
+ BOOST_RANGE_CONCEPT_ASSERT(( ForwardRangeConcept<const ForwardRange> ));
+ return std::remove(boost::begin(rng),boost::end(rng),val);
+}
+
 // range_return overloads
 
 /// \overload
@@ -47,6 +56,17 @@
         rng);
 }
 
+/// \overload
+template< range_return_value re, class ForwardRange, class Value >
+inline BOOST_DEDUCED_TYPENAME range_return<const ForwardRange,re>::type
+remove(const ForwardRange& rng, const Value& val)
+{
+ BOOST_RANGE_CONCEPT_ASSERT(( ForwardRangeConcept<const ForwardRange> ));
+ return range_return<const ForwardRange,re>::pack(
+ std::remove(boost::begin(rng), boost::end(rng), val),
+ rng);
+}
+
     } // namespace range
     using range::remove;
 } // namespace boost

Modified: trunk/boost/range/algorithm/remove_copy.hpp
==============================================================================
--- trunk/boost/range/algorithm/remove_copy.hpp (original)
+++ trunk/boost/range/algorithm/remove_copy.hpp 2010-07-11 20:08:41 EDT (Sun, 11 Jul 2010)
@@ -31,9 +31,9 @@
 /// InputIterator's value type.
 template< class SinglePassRange, class OutputIterator, class Value >
 inline OutputIterator
-remove_copy(SinglePassRange& rng, OutputIterator out_it, const Value& val)
+remove_copy(const SinglePassRange& rng, OutputIterator out_it, const Value& val)
 {
- BOOST_RANGE_CONCEPT_ASSERT(( SinglePassRangeConcept<SinglePassRange> ));
+ BOOST_RANGE_CONCEPT_ASSERT(( SinglePassRangeConcept<const SinglePassRange> ));
     return std::remove_copy(boost::begin(rng), boost::end(rng), out_it, val);
 }
 

Modified: trunk/boost/range/algorithm/remove_copy_if.hpp
==============================================================================
--- trunk/boost/range/algorithm/remove_copy_if.hpp (original)
+++ trunk/boost/range/algorithm/remove_copy_if.hpp 2010-07-11 20:08:41 EDT (Sun, 11 Jul 2010)
@@ -28,9 +28,9 @@
     /// \pre out_it is not an iterator in the range rng
     template< class SinglePassRange, class OutputIterator, class Predicate >
     inline OutputIterator
- remove_copy_if(SinglePassRange& rng, OutputIterator out_it, Predicate pred)
+ remove_copy_if(const SinglePassRange& rng, OutputIterator out_it, Predicate pred)
     {
- BOOST_RANGE_CONCEPT_ASSERT(( SinglePassRangeConcept<SinglePassRange> ));
+ BOOST_RANGE_CONCEPT_ASSERT(( SinglePassRangeConcept<const SinglePassRange> ));
         return std::remove_copy_if(boost::begin(rng), boost::end(rng), out_it, pred);
     }
 }

Modified: trunk/boost/range/algorithm/remove_if.hpp
==============================================================================
--- trunk/boost/range/algorithm/remove_if.hpp (original)
+++ trunk/boost/range/algorithm/remove_if.hpp 2010-07-11 20:08:41 EDT (Sun, 11 Jul 2010)
@@ -35,6 +35,15 @@
     return std::remove_if(boost::begin(rng), boost::end(rng), pred);
 }
 
+/// \overload
+template< class ForwardRange, class UnaryPredicate >
+inline BOOST_DEDUCED_TYPENAME boost::range_iterator<const ForwardRange>::type
+remove_if(const ForwardRange& rng, UnaryPredicate pred)
+{
+ BOOST_RANGE_CONCEPT_ASSERT(( ForwardRangeConcept<const ForwardRange> ));
+ return std::remove_if(boost::begin(rng), boost::end(rng), pred);
+}
+
 // range_return overloads
 
 /// \overload
@@ -48,6 +57,17 @@
         rng);
 }
 
+/// \overload
+template< range_return_value re, class ForwardRange, class UnaryPredicate >
+inline BOOST_DEDUCED_TYPENAME range_return<const ForwardRange,re>::type
+remove_if(const ForwardRange& rng, UnaryPredicate pred)
+{
+ BOOST_RANGE_CONCEPT_ASSERT(( ForwardRangeConcept<const ForwardRange> ));
+ return range_return<const ForwardRange,re>::pack(
+ std::remove_if(boost::begin(rng), boost::end(rng), pred),
+ rng);
+}
+
     } // namespace range
     using range::remove_if;
 } // namespace boost

Modified: trunk/boost/range/algorithm/replace.hpp
==============================================================================
--- trunk/boost/range/algorithm/replace.hpp (original)
+++ trunk/boost/range/algorithm/replace.hpp 2010-07-11 20:08:41 EDT (Sun, 11 Jul 2010)
@@ -35,6 +35,17 @@
     return rng;
 }
 
+/// \overload
+template< class ForwardRange, class Value >
+inline const ForwardRange&
+replace(const ForwardRange& rng, const Value& what,
+ const Value& with_what)
+{
+ BOOST_RANGE_CONCEPT_ASSERT(( ForwardRangeConcept<const ForwardRange> ));
+ std::replace(boost::begin(rng), boost::end(rng), what, with_what);
+ return rng;
+}
+
     } // namespace range
     using range::replace;
 } // namespace boost;

Modified: trunk/boost/range/algorithm/replace_copy.hpp
==============================================================================
--- trunk/boost/range/algorithm/replace_copy.hpp (original)
+++ trunk/boost/range/algorithm/replace_copy.hpp 2010-07-11 20:08:41 EDT (Sun, 11 Jul 2010)
@@ -27,10 +27,10 @@
 /// \pre ForwardRange is a model of the ForwardRangeConcept
 template< class ForwardRange, class OutputIterator, class Value >
 inline OutputIterator
-replace_copy(ForwardRange& rng, OutputIterator out_it, const Value& what,
+replace_copy(const ForwardRange& rng, OutputIterator out_it, const Value& what,
         const Value& with_what)
 {
- BOOST_RANGE_CONCEPT_ASSERT(( ForwardRangeConcept<ForwardRange> ));
+ BOOST_RANGE_CONCEPT_ASSERT(( ForwardRangeConcept<const ForwardRange> ));
     return std::replace_copy(boost::begin(rng), boost::end(rng), out_it,
         what, with_what);
 }

Modified: trunk/boost/range/algorithm/replace_copy_if.hpp
==============================================================================
--- trunk/boost/range/algorithm/replace_copy_if.hpp (original)
+++ trunk/boost/range/algorithm/replace_copy_if.hpp 2010-07-11 20:08:41 EDT (Sun, 11 Jul 2010)
@@ -31,10 +31,10 @@
 /// \pre Value is convertible to a type in OutputIterator's set of value types.
 template< class ForwardRange, class OutputIterator, class Predicate, class Value >
 inline OutputIterator
-replace_copy_if(ForwardRange& rng, OutputIterator out_it, Predicate pred,
+replace_copy_if(const ForwardRange& rng, OutputIterator out_it, Predicate pred,
         const Value& with_what)
 {
- BOOST_RANGE_CONCEPT_ASSERT(( ForwardRangeConcept<ForwardRange> ));
+ BOOST_RANGE_CONCEPT_ASSERT(( ForwardRangeConcept<const ForwardRange> ));
     return std::replace_copy_if(boost::begin(rng), boost::end(rng), out_it,
         pred, with_what);
 }

Modified: trunk/boost/range/algorithm/replace_if.hpp
==============================================================================
--- trunk/boost/range/algorithm/replace_if.hpp (original)
+++ trunk/boost/range/algorithm/replace_if.hpp 2010-07-11 20:08:41 EDT (Sun, 11 Jul 2010)
@@ -36,6 +36,17 @@
     return rng;
 }
 
+/// \overload
+template< class ForwardRange, class UnaryPredicate, class Value >
+inline const ForwardRange&
+ replace_if(const ForwardRange& rng, UnaryPredicate pred,
+ const Value& val)
+{
+ BOOST_RANGE_CONCEPT_ASSERT(( ForwardRangeConcept<const ForwardRange> ));
+ std::replace_if(boost::begin(rng), boost::end(rng), pred, val);
+ return rng;
+}
+
     } // namespace range
     using range::replace_if;
 } // namespace boost

Modified: trunk/boost/range/algorithm/reverse.hpp
==============================================================================
--- trunk/boost/range/algorithm/reverse.hpp (original)
+++ trunk/boost/range/algorithm/reverse.hpp 2010-07-11 20:08:41 EDT (Sun, 11 Jul 2010)
@@ -34,6 +34,15 @@
     return rng;
 }
 
+/// \overload
+template<class BidirectionalRange>
+inline const BidirectionalRange& reverse(const BidirectionalRange& rng)
+{
+ BOOST_RANGE_CONCEPT_ASSERT(( BidirectionalRangeConcept<const BidirectionalRange> ));
+ std::reverse(boost::begin(rng), boost::end(rng));
+ return rng;
+}
+
     } // namespace range
     using range::reverse;
 } // namespace boost

Modified: trunk/boost/range/algorithm/reverse_copy.hpp
==============================================================================
--- trunk/boost/range/algorithm/reverse_copy.hpp (original)
+++ trunk/boost/range/algorithm/reverse_copy.hpp 2010-07-11 20:08:41 EDT (Sun, 11 Jul 2010)
@@ -29,7 +29,7 @@
 template<class BidirectionalRange, class OutputIterator>
 inline OutputIterator reverse_copy(const BidirectionalRange& rng, OutputIterator out)
 {
- BOOST_RANGE_CONCEPT_ASSERT(( BidirectionalRangeConcept<BidirectionalRange> ));
+ BOOST_RANGE_CONCEPT_ASSERT(( BidirectionalRangeConcept<const BidirectionalRange> ));
     return std::reverse_copy(boost::begin(rng), boost::end(rng), out);
 }
 

Modified: trunk/boost/range/algorithm/rotate.hpp
==============================================================================
--- trunk/boost/range/algorithm/rotate.hpp (original)
+++ trunk/boost/range/algorithm/rotate.hpp 2010-07-11 20:08:41 EDT (Sun, 11 Jul 2010)
@@ -34,6 +34,16 @@
     return rng;
 }
 
+/// \overload
+template<class ForwardRange>
+inline const ForwardRange& rotate(const ForwardRange& rng,
+ BOOST_DEDUCED_TYPENAME range_iterator<const ForwardRange>::type middle)
+{
+ BOOST_RANGE_CONCEPT_ASSERT(( ForwardRangeConcept<const ForwardRange> ));
+ std::rotate(boost::begin(rng), middle, boost::end(rng));
+ return rng;
+}
+
     } // namespace range
     using range::rotate;
 } // 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-07-11 20:08:41 EDT (Sun, 11 Jul 2010)
@@ -44,7 +44,7 @@
 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>));
+ BOOST_RANGE_CONCEPT_ASSERT((ForwardRangeConcept<const ForwardRange>));
     return std::search_n(boost::begin(rng), boost::end(rng), count, value);
 }
 
@@ -69,7 +69,7 @@
 search_n(const ForwardRange& rng, Integer count, const Value& value,
          BinaryPredicate binary_pred)
 {
- BOOST_RANGE_CONCEPT_ASSERT((ForwardRangeConcept<ForwardRange>));
+ BOOST_RANGE_CONCEPT_ASSERT((ForwardRangeConcept<const 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),
@@ -97,7 +97,7 @@
 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>));
+ BOOST_RANGE_CONCEPT_ASSERT((ForwardRangeConcept<const ForwardRange>));
     return range_return<const ForwardRange,re>::
         pack(std::search_n(boost::begin(rng), boost::end(rng),
                            count, value),
@@ -128,7 +128,7 @@
 search_n(const ForwardRange& rng, Integer count, const Value& value,
          BinaryPredicate pred)
 {
- BOOST_RANGE_CONCEPT_ASSERT((ForwardRangeConcept<ForwardRange>));
+ BOOST_RANGE_CONCEPT_ASSERT((ForwardRangeConcept<const ForwardRange>));
     BOOST_RANGE_CONCEPT_ASSERT((BinaryPredicateConcept<BinaryPredicate,
         BOOST_DEDUCED_TYPENAME range_value<const ForwardRange>::type,
         const Value&>));

Modified: trunk/boost/range/algorithm/sort.hpp
==============================================================================
--- trunk/boost/range/algorithm/sort.hpp (original)
+++ trunk/boost/range/algorithm/sort.hpp 2010-07-11 20:08:41 EDT (Sun, 11 Jul 2010)
@@ -35,6 +35,15 @@
 }
 
 /// \overload
+template<class RandomAccessRange>
+inline const RandomAccessRange& sort(const RandomAccessRange& rng)
+{
+ BOOST_RANGE_CONCEPT_ASSERT(( RandomAccessRangeConcept<const RandomAccessRange> ));
+ std::sort(boost::begin(rng), boost::end(rng));
+ return rng;
+}
+
+/// \overload
 template<class RandomAccessRange, class BinaryPredicate>
 inline RandomAccessRange& sort(RandomAccessRange& rng, BinaryPredicate pred)
 {
@@ -43,6 +52,15 @@
     return rng;
 }
 
+/// \overload
+template<class RandomAccessRange, class BinaryPredicate>
+inline const RandomAccessRange& sort(const RandomAccessRange& rng, BinaryPredicate pred)
+{
+ BOOST_RANGE_CONCEPT_ASSERT(( RandomAccessRangeConcept<const RandomAccessRange> ));
+ std::sort(boost::begin(rng), boost::end(rng), pred);
+ return rng;
+}
+
     } // namespace range
     using range::sort;
 } // namespace boost

Modified: trunk/boost/range/algorithm/stable_sort.hpp
==============================================================================
--- trunk/boost/range/algorithm/stable_sort.hpp (original)
+++ trunk/boost/range/algorithm/stable_sort.hpp 2010-07-11 20:08:41 EDT (Sun, 11 Jul 2010)
@@ -35,6 +35,15 @@
 }
 
 /// \overload
+template<class RandomAccessRange>
+inline const RandomAccessRange& stable_sort(const RandomAccessRange& rng)
+{
+ BOOST_RANGE_CONCEPT_ASSERT(( RandomAccessRangeConcept<const RandomAccessRange> ));
+ std::stable_sort(boost::begin(rng), boost::end(rng));
+ return rng;
+}
+
+/// \overload
 template<class RandomAccessRange, class BinaryPredicate>
 inline RandomAccessRange& stable_sort(RandomAccessRange& rng, BinaryPredicate sort_pred)
 {
@@ -43,6 +52,15 @@
     return rng;
 }
 
+/// \overload
+template<class RandomAccessRange, class BinaryPredicate>
+inline const RandomAccessRange& stable_sort(const RandomAccessRange& rng, BinaryPredicate sort_pred)
+{
+ BOOST_RANGE_CONCEPT_ASSERT(( RandomAccessRangeConcept<const RandomAccessRange> ));
+ std::stable_sort(boost::begin(rng), boost::end(rng), sort_pred);
+ return rng;
+}
+
     } // namespace range
     using range::stable_sort;
 } // namespace boost

Modified: trunk/boost/range/algorithm/swap_ranges.hpp
==============================================================================
--- trunk/boost/range/algorithm/swap_ranges.hpp (original)
+++ trunk/boost/range/algorithm/swap_ranges.hpp 2010-07-11 20:08:41 EDT (Sun, 11 Jul 2010)
@@ -80,6 +80,51 @@
     return range2;
 }
 
+/// \overload
+template< class SinglePassRange1, class SinglePassRange2 >
+inline SinglePassRange2&
+swap_ranges(const SinglePassRange1& range1, SinglePassRange2& range2)
+{
+ BOOST_RANGE_CONCEPT_ASSERT((SinglePassRangeConcept<const SinglePassRange1>));
+ BOOST_RANGE_CONCEPT_ASSERT((SinglePassRangeConcept<SinglePassRange2>));
+
+ boost::range_detail::swap_ranges_impl(
+ boost::begin(range1), boost::end(range1),
+ boost::begin(range2), boost::end(range2));
+
+ return range2;
+}
+
+/// \overload
+template< class SinglePassRange1, class SinglePassRange2 >
+inline const SinglePassRange2&
+swap_ranges(SinglePassRange1& range1, const SinglePassRange2& range2)
+{
+ BOOST_RANGE_CONCEPT_ASSERT((SinglePassRangeConcept<SinglePassRange1>));
+ BOOST_RANGE_CONCEPT_ASSERT((SinglePassRangeConcept<const SinglePassRange2>));
+
+ boost::range_detail::swap_ranges_impl(
+ boost::begin(range1), boost::end(range1),
+ boost::begin(range2), boost::end(range2));
+
+ return range2;
+}
+
+/// \overload
+template< class SinglePassRange1, class SinglePassRange2 >
+inline const SinglePassRange2&
+swap_ranges(const SinglePassRange1& range1, const SinglePassRange2& range2)
+{
+ BOOST_RANGE_CONCEPT_ASSERT((SinglePassRangeConcept<const SinglePassRange1>));
+ BOOST_RANGE_CONCEPT_ASSERT((SinglePassRangeConcept<const SinglePassRange2>));
+
+ boost::range_detail::swap_ranges_impl(
+ boost::begin(range1), boost::end(range1),
+ boost::begin(range2), boost::end(range2));
+
+ return range2;
+}
+
     } // namespace range
     using range::swap_ranges;
 } // namespace boost

Modified: trunk/boost/range/algorithm/upper_bound.hpp
==============================================================================
--- trunk/boost/range/algorithm/upper_bound.hpp (original)
+++ trunk/boost/range/algorithm/upper_bound.hpp 2010-07-11 20:08:41 EDT (Sun, 11 Jul 2010)
@@ -33,7 +33,16 @@
     BOOST_RANGE_CONCEPT_ASSERT(( ForwardRangeConcept<ForwardRange> ));
     return std::upper_bound(boost::begin(rng), boost::end(rng), val);
 }
+
 /// \overload
+template< class ForwardRange, class Value >
+inline BOOST_DEDUCED_TYPENAME range_iterator<const ForwardRange>::type
+upper_bound( const ForwardRange& rng, Value val )
+{
+ BOOST_RANGE_CONCEPT_ASSERT(( ForwardRangeConcept<const ForwardRange> ));
+ return std::upper_bound(boost::begin(rng), boost::end(rng), val);
+}
+
 /// \overload
 template< class ForwardRange, class Value, class SortPredicate >
 inline BOOST_DEDUCED_TYPENAME range_iterator<ForwardRange>::type
@@ -42,6 +51,16 @@
     BOOST_RANGE_CONCEPT_ASSERT(( ForwardRangeConcept<ForwardRange> ));
     return std::upper_bound(boost::begin(rng), boost::end(rng), val, pred);
 }
+
+/// \overload
+template< class ForwardRange, class Value, class SortPredicate >
+inline BOOST_DEDUCED_TYPENAME range_iterator<const ForwardRange>::type
+upper_bound( const ForwardRange& rng, Value val, SortPredicate pred )
+{
+ BOOST_RANGE_CONCEPT_ASSERT(( ForwardRangeConcept<const ForwardRange> ));
+ return std::upper_bound(boost::begin(rng), boost::end(rng), val, pred);
+}
+
 /// \overload
 template< range_return_value re, class ForwardRange, class Value >
 inline BOOST_DEDUCED_TYPENAME range_return<ForwardRange,re>::type
@@ -52,6 +71,18 @@
         pack(std::upper_bound(boost::begin(rng), boost::end(rng), val),
              rng);
 }
+
+/// \overload
+template< range_return_value re, class ForwardRange, class Value >
+inline BOOST_DEDUCED_TYPENAME range_return<const ForwardRange,re>::type
+upper_bound( const ForwardRange& rng, Value val )
+{
+ BOOST_RANGE_CONCEPT_ASSERT(( ForwardRangeConcept<const ForwardRange> ));
+ return range_return<const ForwardRange,re>::
+ pack(std::upper_bound(boost::begin(rng), boost::end(rng), val),
+ rng);
+}
+
 /// \overload
 template< range_return_value re, class ForwardRange, class Value,
           class SortPredicate >
@@ -64,6 +95,18 @@
              rng);
 }
 
+/// \overload
+template< range_return_value re, class ForwardRange, class Value,
+ class SortPredicate >
+inline BOOST_DEDUCED_TYPENAME range_return<const ForwardRange,re>::type
+upper_bound( const ForwardRange& rng, Value val, SortPredicate pred )
+{
+ BOOST_RANGE_CONCEPT_ASSERT(( ForwardRangeConcept<const ForwardRange> ));
+ return range_return<const ForwardRange,re>::
+ pack(std::upper_bound(boost::begin(rng), boost::end(rng), val, pred),
+ rng);
+}
+
     } // namespace range
     using range::upper_bound;
 } // namespace boost

Modified: trunk/boost/range/algorithm_ext/iota.hpp
==============================================================================
--- trunk/boost/range/algorithm_ext/iota.hpp (original)
+++ trunk/boost/range/algorithm_ext/iota.hpp 2010-07-11 20:08:41 EDT (Sun, 11 Jul 2010)
@@ -34,6 +34,19 @@
     return rng;
 }
 
+template< class ForwardRange, class Value >
+inline const ForwardRange& iota( const ForwardRange& rng, Value x )
+{
+ BOOST_CONCEPT_ASSERT(( ForwardRangeConcept<const ForwardRange> ));
+ typedef BOOST_DEDUCED_TYPENAME range_iterator<const ForwardRange>::type iterator_t;
+
+ iterator_t last_target = ::boost::end(rng);
+ for (iterator_t target = ::boost::begin(rng); target != last_target; ++target, ++x)
+ *target = x;
+
+ return rng;
+}
+
     } // namespace range
     using range::iota;
 } // namespace boost

Modified: trunk/boost/range/algorithm_ext/is_sorted.hpp
==============================================================================
--- trunk/boost/range/algorithm_ext/is_sorted.hpp (original)
+++ trunk/boost/range/algorithm_ext/is_sorted.hpp 2010-07-11 20:08:41 EDT (Sun, 11 Jul 2010)
@@ -51,7 +51,7 @@
 inline bool is_sorted(const SinglePassRange& rng)
 {
     BOOST_RANGE_CONCEPT_ASSERT((SinglePassRangeConcept<const SinglePassRange>));
- BOOST_RANGE_CONCEPT_ASSERT((LessThanComparableConcept<BOOST_DEDUCED_TYPENAME range_value<SinglePassRange>::type>));
+ BOOST_RANGE_CONCEPT_ASSERT((LessThanComparableConcept<BOOST_DEDUCED_TYPENAME range_value<const SinglePassRange>::type>));
     return range_detail::is_sorted(boost::begin(rng), boost::end(rng));
 }
 
@@ -59,8 +59,8 @@
 template<class SinglePassRange, class BinaryPredicate>
 inline bool is_sorted(const SinglePassRange& rng, BinaryPredicate pred)
 {
- BOOST_RANGE_CONCEPT_ASSERT((SinglePassRangeConcept<SinglePassRange>));
- BOOST_RANGE_CONCEPT_ASSERT((BinaryPredicateConcept<BinaryPredicate, BOOST_DEDUCED_TYPENAME range_value<SinglePassRange>::type, BOOST_DEDUCED_TYPENAME range_value<SinglePassRange>::type>));
+ BOOST_RANGE_CONCEPT_ASSERT((SinglePassRangeConcept<const SinglePassRange>));
+ BOOST_RANGE_CONCEPT_ASSERT((BinaryPredicateConcept<BinaryPredicate, BOOST_DEDUCED_TYPENAME range_value<const SinglePassRange>::type, BOOST_DEDUCED_TYPENAME range_value<const SinglePassRange>::type>));
     return range_detail::is_sorted(boost::begin(rng), boost::end(rng), pred);
 }
 

Modified: trunk/boost/range/algorithm_ext/overwrite.hpp
==============================================================================
--- trunk/boost/range/algorithm_ext/overwrite.hpp (original)
+++ trunk/boost/range/algorithm_ext/overwrite.hpp 2010-07-11 20:08:41 EDT (Sun, 11 Jul 2010)
@@ -50,6 +50,33 @@
     }
 }
 
+template< class SinglePassRange1, class SinglePassRange2 >
+inline void overwrite( const SinglePassRange1& from, const SinglePassRange2& to )
+{
+ BOOST_RANGE_CONCEPT_ASSERT(( SinglePassRangeConcept<const SinglePassRange1> ));
+ BOOST_RANGE_CONCEPT_ASSERT(( SinglePassRangeConcept<const SinglePassRange2> ));
+
+ BOOST_DEDUCED_TYPENAME range_iterator<const SinglePassRange1>::type
+ i = boost::begin(from), e = boost::end(from);
+
+ BOOST_DEDUCED_TYPENAME range_iterator<const SinglePassRange2>::type
+ out = boost::begin(to);
+
+#ifndef NDEBUG
+ BOOST_DEDUCED_TYPENAME range_iterator<const SinglePassRange2>::type
+ last_out = boost::end(to);
+#endif
+
+ for( ; i != e; ++out, ++i )
+ {
+#ifndef NDEBUG
+ BOOST_ASSERT( out != last_out
+ && "out of bounds in boost::overwrite()" );
+#endif
+ *out = *i;
+ }
+}
+
     } // namespace range
     using range::overwrite;
 } // namespace boost


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