Skip to content

Bad is_sorted docs #145

@BenFrantzDale

Description

@BenFrantzDale

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions