[Boost-bugs] [Boost C++ Libraries] #10483: boost::is_sorted docs incorrectly describe predicate

Subject: [Boost-bugs] [Boost C++ Libraries] #10483: boost::is_sorted docs incorrectly describe predicate
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2014-09-09 13:13:34


#10483: boost::is_sorted docs incorrectly describe predicate
------------------------------+------------------------
 Reporter: charlie@… | Owner: neilgroves
     Type: Bugs | Status: new
Milestone: To Be Determined | Component: range
  Version: Boost 1.55.0 | Severity: Problem
 Keywords: |
------------------------------+------------------------
 From the documentation

  For the non-predicate version the return value is true if and only if for
 each adjacent elements [x,y] the expression x < y is true

 and similarly for the predicate version. This isn't the case however.

 From the standard [alg.sorting]
  A sequence is sorted with respect to a comparator comp if for any
 iterator i pointing to the sequence and any non-negative integer n such
 that i + n is a valid iterator pointing to an element of the sequence,
 comp(*(i + n), *i) == false.

 So the docs should say
  the expression y < x is false

 I get the following with g++'s underlying is_sorted():
 {{{
   std::vector<int> v{1, 1};
   std::cout << boost::is_sorted(v) << std::endl; // prints 1
 }}}

 Reference for is_sorted at cplusplus.com [sorry not allowed to post a
 link] backs this up.

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/10483>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:16 UTC