Opened 5 years ago
Last modified 5 years ago
#13383 new Bugs
Doc for is_sorted() incorrectly states the predicate defaults to std::less_equal
Reported by: | Owned by: | Marshall Clow | |
---|---|---|---|
Milestone: | To Be Determined | Component: | algorithm |
Version: | Boost Development Trunk | Severity: | Problem |
Keywords: | predicate, is_sorted, algorithm, less, less_equal | Cc: |
Description
#include <boost/algorithm/cxx11/is_sorted.hpp> #include <iostream> #include <vector> int main () { std::vector<int> a = { 1, 2, 2, 3 }; std::cerr << "default : " << std::boolalpha << boost::algorithm::is_sorted( a ) << "\n"; std::cerr << "less : " << std::boolalpha << boost::algorithm::is_sorted( a, std::less <>{} ) << "\n"; std::cerr << "less_equal: " << std::boolalpha << boost::algorithm::is_sorted( a, std::less_equal<>{} ) << "\n"; }
Change History (1)
comment:1 by , 5 years ago
Component: | None → algorithm |
---|---|
Keywords: | predicate is_sorted algorithm less less_equal added |
Owner: | set to |
Summary: | is_sorted() doc incorrectly says the predicate defaults to std::less_equal → Doc for is_sorted() incorrectly states the predicate defaults to std::less_equal |
Version: | Boost 1.63.0 → Boost Development Trunk |
Note:
See TracTickets
for help on using tickets.
(Apologies for the description at the top being a mess. My original submission had external links in and I was forced to do a captcha. That failed over and over until I ended up trying to use browser "back" and "reload" to try to recover my original submission and eventually found I'd submitted an early draft.)
Second, terser version of lost text...
Doc for
is_sorted()
says:That's not true, it's
std::less
- see line 60 ofboost/algorithm/cxx11/is_sorted.hpp
.This code confirms the default behaviour matches
std::less
notstd::less_equal
.I vote: change docs, not code. Because: that matches
std::
.