diff --git a/doc/ordered-hpp.qbk b/doc/ordered-hpp.qbk index 718f1f9..9e860d4 100644 --- a/doc/ordered-hpp.qbk +++ b/doc/ordered-hpp.qbk @@ -19,11 +19,11 @@ The function `is_sorted(sequence)` determines whether or not a sequence is compl `` namespace boost { namespace algorithm { - template - bool is_sorted ( Iterator first, Iterator last, Pred p ); + template + bool is_sorted ( ForwardIterator first, ForwardIterator last, Pred p ); - template - bool is_sorted ( Iterator first, Iterator last ); + template + bool is_sorted ( ForwardIterator first, ForwardIterator last ); template @@ -34,7 +34,7 @@ namespace boost { namespace algorithm { }} `` -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 @@ To test if a sequence is decreasing (each element no larger than the preceding o `` namespace boost { namespace algorithm { - template - bool is_decreasing ( Iterator first, Iterator last ); + template + bool is_decreasing ( ForwardIterator first, ForwardIterator last ); template bool is_decreasing ( const R &range ); @@ -99,8 +99,8 @@ namespace boost { namespace algorithm { To test if a sequence is strictly increasing (each element larger than the preceding one): `` namespace boost { namespace algorithm { - template - bool is_strictly_increasing ( Iterator first, Iterator last ); + template + bool is_strictly_increasing ( ForwardIterator first, ForwardIterator last ); template bool is_strictly_increasing ( const R &range ); @@ -110,8 +110,8 @@ namespace boost { namespace algorithm { To test if a sequence is strictly decreasing (each element smaller than the preceding one): `` namespace boost { namespace algorithm { - template - bool is_strictly_decreasing ( Iterator first, Iterator last ); + template + bool is_strictly_decreasing ( ForwardIterator first, ForwardIterator last ); template bool is_strictly_decreasing ( const R &range ); diff --git a/include/boost/algorithm/cxx11/iota.hpp b/include/boost/algorithm/cxx11/iota.hpp index b4f0daf..eb32390 100644 --- a/include/boost/algorithm/cxx11/iota.hpp +++ b/include/boost/algorithm/cxx11/iota.hpp @@ -63,8 +63,8 @@ void iota ( Range &r, T value ) template 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; } diff --git a/include/boost/algorithm/cxx11/is_permutation.hpp b/include/boost/algorithm/cxx11/is_permutation.hpp index e1273f1..3eff5ce 100644 --- a/include/boost/algorithm/cxx11/is_permutation.hpp +++ b/include/boost/algorithm/cxx11/is_permutation.hpp @@ -21,7 +21,6 @@ #include #include #include -#include // for tie namespace boost { namespace algorithm { @@ -121,7 +120,6 @@ bool is_permutation ( ForwardIterator1 first1, ForwardIterator1 last1, ForwardIterator2 first2, BinaryPredicate p ) { // Skip the common prefix (if any) -// std::tie (first1, first2) = std::mismatch (first1, last1, first2, p); std::pair eq = std::mismatch (first1, last1, first2, p); first1 = eq.first; first2 = eq.second; diff --git a/include/boost/algorithm/searching/detail/bm_traits.hpp b/include/boost/algorithm/searching/detail/bm_traits.hpp index ea150c3..9c25540 100644 --- a/include/boost/algorithm/searching/detail/bm_traits.hpp +++ b/include/boost/algorithm/searching/detail/bm_traits.hpp @@ -20,7 +20,11 @@ #include #include +#ifdef BOOST_NO_CXX11_HDR_UNORDERED_MAP #include +#else +#include +#endif #include @@ -35,7 +39,11 @@ namespace boost { namespace algorithm { namespace detail { template class skip_table { private: +#ifdef BOOST_NO_CXX11_HDR_UNORDERED_MAP typedef std::tr1::unordered_map skip_map; +#else + typedef std::unordered_map skip_map; +#endif const value_type k_default_value; skip_map skip_; diff --git a/test/iota_test1.cpp b/test/iota_test1.cpp index 080d3d7..747691f 100644 --- a/test/iota_test1.cpp +++ b/test/iota_test1.cpp @@ -42,11 +42,11 @@ void test_ints () { std::vector v; std::list 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 @@ void test_ints () { 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 );