Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r86757 - in branches/release: boost/algorithm/cxx11 boost/algorithm/searching/detail libs/algorithm/doc libs/algorithm/test
From: marshall_at_[hidden]
Date: 2013-11-18 11:52:09


Author: marshall
Date: 2013-11-18 11:52:09 EST (Mon, 18 Nov 2013)
New Revision: 86757
URL: http://svn.boost.org/trac/boost/changeset/86757

Log:
Merge a bunch of minor Boost.Algorithm changes to release

Properties modified:
   branches/release/boost/algorithm/cxx11/iota.hpp (contents, props changed)
   branches/release/boost/algorithm/cxx11/is_permutation.hpp (contents, props changed)
   branches/release/boost/algorithm/searching/detail/bm_traits.hpp (contents, props changed)
   branches/release/libs/algorithm/doc/ordered-hpp.qbk (contents, props changed)
   branches/release/libs/algorithm/test/iota_test1.cpp (contents, props changed)
Text files modified:
   branches/release/boost/algorithm/cxx11/iota.hpp | 4 ++--
   branches/release/boost/algorithm/cxx11/is_permutation.hpp | 2 --
   branches/release/boost/algorithm/searching/detail/bm_traits.hpp | 8 ++++++++
   branches/release/libs/algorithm/doc/ordered-hpp.qbk | 22 +++++++++++-----------
   branches/release/libs/algorithm/test/iota_test1.cpp | 8 ++++++--
   5 files changed, 27 insertions(+), 17 deletions(-)

Modified: branches/release/boost/algorithm/cxx11/iota.hpp
==============================================================================
--- branches/release/boost/algorithm/cxx11/iota.hpp Mon Nov 18 10:18:50 2013 (r86756)
+++ branches/release/boost/algorithm/cxx11/iota.hpp 2013-11-18 11:52:09 EST (Mon, 18 Nov 2013) (r86757)
@@ -63,8 +63,8 @@
 template <typename OutputIterator, typename T>
 OutputIterator iota_n ( OutputIterator out, T value, std::size_t n )
 {
- while ( n-- > 0 )
- *out++ = value++;
+ for ( ; n > 0; --n, ++value )
+ *out++ = value;
 
     return out;
 }

Modified: branches/release/boost/algorithm/cxx11/is_permutation.hpp
==============================================================================
--- branches/release/boost/algorithm/cxx11/is_permutation.hpp Mon Nov 18 10:18:50 2013 (r86756)
+++ branches/release/boost/algorithm/cxx11/is_permutation.hpp 2013-11-18 11:52:09 EST (Mon, 18 Nov 2013) (r86757)
@@ -21,7 +21,6 @@
 #include <boost/range/end.hpp>
 #include <boost/utility/enable_if.hpp>
 #include <boost/type_traits/is_same.hpp>
-#include <boost/tr1/tr1/tuple> // for tie
 
 namespace boost { namespace algorithm {
 
@@ -121,7 +120,6 @@
                       ForwardIterator2 first2, BinaryPredicate p )
 {
 // Skip the common prefix (if any)
-// std::tie (first1, first2) = std::mismatch (first1, last1, first2, p);
     std::pair<ForwardIterator1, ForwardIterator2> eq = std::mismatch (first1, last1, first2, p);
     first1 = eq.first;
     first2 = eq.second;

Modified: branches/release/boost/algorithm/searching/detail/bm_traits.hpp
==============================================================================
--- branches/release/boost/algorithm/searching/detail/bm_traits.hpp Mon Nov 18 10:18:50 2013 (r86756)
+++ branches/release/boost/algorithm/searching/detail/bm_traits.hpp 2013-11-18 11:52:09 EST (Mon, 18 Nov 2013) (r86757)
@@ -20,7 +20,11 @@
 #include <boost/type_traits/remove_const.hpp>
 
 #include <boost/array.hpp>
+#ifdef BOOST_NO_CXX11_HDR_UNORDERED_MAP
 #include <boost/tr1/tr1/unordered_map>
+#else
+#include <unordered_map>
+#endif
 
 #include <boost/algorithm/searching/detail/debugging.hpp>
 
@@ -35,7 +39,11 @@
     template<typename key_type, typename value_type>
     class skip_table<key_type, value_type, false> {
     private:
+#ifdef BOOST_NO_CXX11_HDR_UNORDERED_MAP
         typedef std::tr1::unordered_map<key_type, value_type> skip_map;
+#else
+ typedef std::unordered_map<key_type, value_type> skip_map;
+#endif
         const value_type k_default_value;
         skip_map skip_;
         

Modified: branches/release/libs/algorithm/doc/ordered-hpp.qbk
==============================================================================
--- branches/release/libs/algorithm/doc/ordered-hpp.qbk Mon Nov 18 10:18:50 2013 (r86756)
+++ branches/release/libs/algorithm/doc/ordered-hpp.qbk 2013-11-18 11:52:09 EST (Mon, 18 Nov 2013) (r86757)
@@ -19,11 +19,11 @@
 
 ``
 namespace boost { namespace algorithm {
- template <typename Iterator, typename Pred>
- bool is_sorted ( Iterator first, Iterator last, Pred p );
+ template <typename ForwardIterator, typename Pred>
+ bool is_sorted ( ForwardIterator first, ForwardIterator last, Pred p );
         
- template <typename Iterator>
- bool is_sorted ( Iterator first, Iterator last );
+ template <typename ForwardIterator>
+ bool is_sorted ( ForwardIterator first, ForwardIterator last );
         
         
         template <typename Range, typename Pred>
@@ -34,7 +34,7 @@
 }}
 ``
 
-Iterator requirements: The `is_sorted` functions will work on all kinds of iterators (except output iterators).
+Iterator requirements: The `is_sorted` functions will work forward iterators or better.
 
 [heading is_sorted_until]
 
@@ -88,8 +88,8 @@
 
 ``
 namespace boost { namespace algorithm {
- template <typename Iterator>
- bool is_decreasing ( Iterator first, Iterator last );
+ template <typename ForwardIterator>
+ bool is_decreasing ( ForwardIterator first, ForwardIterator last );
         
         template <typename R>
         bool is_decreasing ( const R &range );
@@ -99,8 +99,8 @@
 To test if a sequence is strictly increasing (each element larger than the preceding one):
 ``
 namespace boost { namespace algorithm {
- template <typename Iterator>
- bool is_strictly_increasing ( Iterator first, Iterator last );
+ template <typename ForwardIterator>
+ bool is_strictly_increasing ( ForwardIterator first, ForwardIterator last );
         
         template <typename R>
         bool is_strictly_increasing ( const R &range );
@@ -110,8 +110,8 @@
 To test if a sequence is strictly decreasing (each element smaller than the preceding one):
 ``
 namespace boost { namespace algorithm {
- template <typename Iterator>
- bool is_strictly_decreasing ( Iterator first, Iterator last );
+ template <typename ForwardIterator>
+ bool is_strictly_decreasing ( ForwardIterator first, ForwardIterator last );
         
         template <typename R>
         bool is_strictly_decreasing ( const R &range );

Modified: branches/release/libs/algorithm/test/iota_test1.cpp
==============================================================================
--- branches/release/libs/algorithm/test/iota_test1.cpp Mon Nov 18 10:18:50 2013 (r86756)
+++ branches/release/libs/algorithm/test/iota_test1.cpp 2013-11-18 11:52:09 EST (Mon, 18 Nov 2013) (r86757)
@@ -42,11 +42,11 @@
     std::vector<int> v;
     std::list<int> l;
 
- v.clear (); v.reserve ( 10 );
+ v.clear (); v.resize ( 10 );
     boost::algorithm::iota ( v.begin (), v.end (), 23 );
     BOOST_CHECK ( test_iota_results ( v.begin (), v.end (), 23 ));
     
- v.clear (); v.reserve ( 19 );
+ v.clear (); v.resize ( 19 );
     boost::algorithm::iota ( v, 18 );
     BOOST_CHECK ( test_iota_results ( v, 18 ));
     
@@ -54,6 +54,10 @@
     boost::algorithm::iota_n ( std::back_inserter(v), 99, 20 );
     BOOST_CHECK ( test_iota_results ( v, 99 ));
     
+ v.clear ();
+ boost::algorithm::iota_n ( std::back_inserter(v), 99, 0 );
+ BOOST_CHECK ( v.size() == 0 );
+
 /*
     l.clear (); l.reserve ( 5 );
     boost::algorithm::iota ( l.begin (), l.end (), 123 );


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