-
-
Notifications
You must be signed in to change notification settings - Fork 14.5k
Closed
Labels
A-collectionsArea: `std::collections`Area: `std::collections`C-feature-acceptedCategory: A feature request that has been accepted pending implementation.Category: A feature request that has been accepted pending implementation.T-libs-apiRelevant to the library API team, which will review and decide on the PR/issue.Relevant to the library API team, which will review and decide on the PR/issue.
Description
I just used binary_search inside a loop and realized that it would be nice to check before the loop if my immutable slice was sorted. So I spent 10 minutes going through the standard library just to find out that there aren't any is_sorted, is_sorted_by, is_sorted_by_key, etc. algorithms implemented for neither slices nor iterators.
We should add:
-
Iterator::is_sorted -
Iterator::is_sorted_by -
Iterator::is_sorted_by_key
and since Iterator is implemented for slices, we can add those methods to slices as well by just forwarding to the Iterator implementation.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
A-collectionsArea: `std::collections`Area: `std::collections`C-feature-acceptedCategory: A feature request that has been accepted pending implementation.Category: A feature request that has been accepted pending implementation.T-libs-apiRelevant to the library API team, which will review and decide on the PR/issue.Relevant to the library API team, which will review and decide on the PR/issue.