Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bad is_sorted docs #145

Open
BenFrantzDale opened this issue Apr 21, 2023 · 0 comments
Open

Bad is_sorted docs #145

BenFrantzDale opened this issue Apr 21, 2023 · 0 comments

Comments

@BenFrantzDale
Copy link
Contributor

BenFrantzDale commented Apr 21, 2023

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.
BenFrantzDale added a commit to BenFrantzDale/range that referenced this issue Apr 21, 2023
neilgroves added a commit that referenced this issue Apr 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant