Bad is_sorted docs

Open
#145 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
1/5
Estimated time
Under an hour
Newbie friendliness
55/100
Issue type
Documentation
Clarity
Clearly specified
Activity status
Stale
Tech stack
cpp
Domain
documentation

Research direction

Open doc/reference/algorithm_ext/is_sorted.qbk and compare the two documented return-value descriptions with the issue's proposed wording. Update the non-predicate and predicate explanations so equal adjacent elements and empty or single-element ranges are handled correctly, then review the rendered documentation for the corrected statements.

Written by the indexing model from the issue text.

Description

In https://github.com/boostorg/range/blob/develop/doc/reference/algorithm_ext/is_sorted.qbk:

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`.
For the predicate version the return value is `true` is and only if for each
adjacent elements `[x,y]` the expression `pred(x,y)` is `true`.

note that's describing a strict ordering, which would treat 0, 0 as not sorted!

I think it should read

For the non-predicate version the return value is `true` if and only if for
each adjacent elements `[x, y]` the expression `y < x` is `false` (i.e., `x <= y`), or if the number of elements is zero or one.
For the predicate version the return value is `true` is and only if for each
adjacent elements `[x, y]` the expression `pred(y, x)` is `false`, or if the number of elements is zero or one.
Dominant language
C++
Stars
45
Forks
104
PR merge metrics
No merged PRs in 30d

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from boostorg/range

All issues in boostorg/range

Similar issues

More C++ issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.