The OpenD Programming Language

equal.equal

Compares two or more ranges for equality. The ranges may have different element types, as long as all are comparable by means of the pred. Performs O(min(rs[0].length, rs[1].length, ...)) evaluations of pred. However, if equal is invoked with the default predicate, the implementation may take the liberty to use faster implementations that have the theoretical worst-case O(max(rs[0].length, rs[1].length, ...)).

At least one of the ranges must be finite. If one range involved is infinite, the result is (statically known to be) false.

If the ranges have different kinds of UTF code unit (char, wchar, or dchar), then they are compared using UTF decoding to avoid accidentally integer-promoting units.

template equal(alias pred = "a == b")
bool
equal
(
Ranges...
)
(
Ranges rs
)
if (
rs.length > 1 &&
&&
&&
is(typeof(binaryFun!pred(rs[0].front, rs[1].front)))
&&
(
rs.length == 2 ||
is(typeof(equal!pred(rs[1 .. $])) == bool)
)
)

Parameters

rs Ranges

The ranges to be compared.

Return Value

Type: bool

true if and only if all ranges compare equal element for element, according to binary predicate pred.

Meta