View source code
Display the source code in std/algorithm/comparison.d from which this page was generated on github.
Report a bug
If you spot a problem with this page, click here to create a Bugzilla issue.
Improve this page
Quickly fork, edit online, and submit a pull request for this page. Requires a signed-in GitHub account. This works well for small changes. If you'd like to make larger changes you may want to consider using local clone.

Function std.algorithm.comparison.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 Ο(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 Ο(max(rs[0].length, rs[1].length, ...)).

bool equal(Ranges...) (
  Ranges rs
)
if (rs.length > 1 && allSatisfy!(isInputRange, Ranges) && !allSatisfy!(isInfinite, Ranges) && is(typeof(binaryFun!pred(rs[0].front, rs[1].front))) && (rs.length == 2 || is(typeof(equal!pred(rs[1..__dollar])) == bool)));

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.

Parameters

NameDescription
rs The ranges to be compared.

Returns

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

Authors

Andrei Alexandrescu

License

Boost License 1.0.