Struct std.range.SortedRange
Represents a sorted range. In addition to the regular range
   primitives, supports additional operations that take advantage of the
   ordering, such as merge and binary search. To obtain a    SortedRange from an unsorted range r, use
   sort which sorts r in place and returns the
   corresponding SortedRange. To construct a SortedRange from a range
   r that is known to be already sorted, use assumeSorted.
						
				struct SortedRange(Range, alias pred, SortedRangeOptions opt = SortedRangeOptions
				  
				
				if (isInputRange!Range && !isInstanceOf!(SortedRange, Range));
						
						
				alias SortedRange(Range, alias pred, SortedRangeOptions opt = SortedRangeOptions
				Struct SortedRange
Properties
| Name | Type | Description | 
|---|---|---|
| back[get] | auto | Range primitives. | 
| empty[get] | bool | Range primitives. | 
| front[get] | auto | Range primitives. | 
| save[get] | auto | Range primitives. | 
Methods
| Name | Description | 
|---|---|
| contains(value) | Returns trueif and only ifvaluecan be found inrange, which is assumed to be sorted. Performs Ο(log(r)
evaluations ofpred. | 
| equalRange(value) | Returns the subrange containing all elements efor which both   pred(e, value)andpred(value, e)evaluate tofalse(e.g.,
   ifpredis "less than", returns the portion of the range with
   elements equal tovalue). Uses a classic binary search with
   interval halving until it finds a value that satisfies the condition,
   then usesSearchPolicyto find the left boundary
   andSearchPolicyto find the right boundary. These
   policies are justified by the fact that the two boundaries are likely
   to be near the first found value (i.e., equal ranges are relatively
   small). Completes the entire search in Ο(log(n)) time. | 
| groupBy() | Returns a range of subranges of elements that are equivalent according to the sorting relation. | 
| lowerBound(value) | This function uses a search with policy spto find the
   largest left subrange on whichpred(x, value)istruefor
   allx(e.g., ifpredis "less than", returns the portion of
   the range with elements strictly smaller thanvalue). The search
   schedule and its complexity are documented inSearchPolicy. | 
| opBinaryRight(value) | Like contains, but the value is specified before the range. | 
| opIndex(i) | Range primitives. | 
| opSlice(a, b) | Range primitives. | 
| popBack() | Range primitives. | 
| popFront() | Range primitives. | 
| release() | Releases the controlled range and returns it. | 
| trisect(value) | Returns a tuple rsuch thatr[0]is the same as the result
oflowerBound(value),r[1]is the same as the result ofequalRange(value), andr[2]is the same as the result ofupperBound(value). The call is faster than computing all three
separately. Uses a search schedule similar toequalRange. Completes the entire search in Ο(log(n)) time. | 
| upperBound(value) | This function searches with policy spto find the largest right
subrange on whichpred(value, x)istruefor allx(e.g., ifpredis "less than", returns the portion of the range
with elements strictly greater thanvalue). The search schedule
and its complexity are documented inSearchPolicy. | 
Alias SortedRange
Parameters
| Name | Description | 
|---|
pred
The predicate used to define the sortedness
opt
Controls how strongly the range is checked for sortedness.
            Will only be used for RandomAccessRanges.
            Will not be used in CTFE.
Example
import stdExample
SortedRange could accept ranges weaker than random-access, but it
is unable to provide interesting functionality for them. Therefore,
SortedRange is currently restricted to random-access ranges.
No copy of the original range is ever made. If the underlying range is
changed concurrently with its corresponding SortedRange in ways
that break its sorted-ness, SortedRange will work erratically.
import stdExample
SortedRange can be searched with predicates that do not take
two elements of the underlying range as arguments.
This is useful, if a range of structs is sorted by a member and you want to search in that range by only providing a value for that member.
import stdAuthors
Andrei Alexandrescu, David Simcha, Jonathan M Davis, and Jack Stouffer. Credit for some of the ideas in building this module goes to Leonardo Maffi.