On Friday, 11 May 2012 at 19:01:25 UTC, jerro wrote:
Just a note: I believe I *had* seen SortedRange in the docs,
but I'd never realized there's something called assumeSorted()
that I was supposed to call... so I was searching up and down
for how to search an *arbitrary* container, not how to search
something which was already pre-sorted for me.
(In retrospect, I probably should've just coded binary search
myself...)
It's very counterintuitive to have to make a new object (or
struct) just to do binary search on an array...
Maybe the documentation changed since, but currently the
documentation for SortedRange says:
"To construct a SortedRange from a range r that is known to be
already sorted, use assumeSorted described below."
And there is assumeSorted in the example.
Yeah, either I missed, or I just didn't look at it, and skipped
it entirely just by the header (I don't remember). The point was
that it simply wasn't what/where I expected to be.