extent

Generate a single Range!T that covers the entire set of values found in an array of Range!T, i.e. whose min, max values reflect the smallest and largest min and max found in the array.

It is assumed that the array is sorted already in lexicographical order: first compare the left boundaries of the range, if they are equal then the right boundaries will be compared (that is current status quo of opCmp). All empty ranges are ignored.

Note: Although this method assumes sorted input, it would be possible to provide another implementation without this assumption. However, such an implementation would be more expensive, with an asymptotic complexity of O(n), whereas this version is O(1).

Range!(T)
extent
(
T
)
()

Parameters

ranges Range!(T)[]

a sorted array of Range!T

Return Value

Type: Range!(T)

resulting minimal covering range, or an empty range if the input array is empty

Meta