Closed
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.