MoveableSortedRange

Undocumented in source.

Constructors

this
this(Range input)
Undocumented in source.

Members

Aliases

opDollar
alias opDollar = length

Range primitives.

Functions

contains
bool contains(V value)

Returns true if and only if value can be found in range, which is assumed to be sorted. Performs O(log(r.length)) evaluations of pred. See_Also: STL's binary_search.

equalRange
auto equalRange(V value)

Returns the subrange containing all elements e for which both pred(e, value) and pred(value, e) evaluate to false (e.g., if pred is "less than", returns the portion of the range with elements equal to value). Uses a classic binary search with interval halving until it finds a value that satisfies the condition, then uses SearchPolicy.gallopBackwards to find the left boundary and SearchPolicy.gallop to 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 O(log(n)) time. See also STL's equal_range.

groupBy
auto groupBy()

Returns a range of subranges of elements that are equivalent according to the sorting relation.

lowerBound
auto lowerBound(V value)

This function uses a search with policy sp to find the largest left subrange on which pred(x, value) is true for all x (e.g., if pred is "less than", returns the portion of the range with elements strictly smaller than value). The search schedule and its complexity are documented in SearchPolicy. See_Also: STL's lower_bound.

opIndex
auto ref opIndex(size_t i)
opSlice
auto opSlice(size_t a, size_t b)
popBack
void popBack()
popFront
void popFront()

Range primitives.

release
auto release()

Releases the controlled range and returns it.

trisect
auto trisect(V value)

Returns a tuple r such that r[0] is the same as the result of lowerBound(value), r[1] is the same as the result of equalRange(value), and r[2] is the same as the result of upperBound(value). The call is faster than computing all three separately. Uses a search schedule similar to equalRange. Completes the entire search in O(log(n)) time.

upperBound
auto upperBound(V value)

This function searches with policy sp to find the largest right subrange on which pred(value, x) is true for all x (e.g., if pred is "less than", returns the portion of the range with elements strictly greater than value). The search schedule and its complexity are documented in SearchPolicy.

Properties

back
auto ref back [@property getter]

Range primitives.

empty
bool empty [@property getter]
front
auto ref front [@property getter]
length
size_t length [@property getter]
save
auto save [@property getter]

Range primitives.

Meta