Range.opEquals

Checks whether the specified range is exactly identical to this range.

struct Range(T)
equals_t
opEquals
(
This other
)

Parameters

other This

instance to compare this with

Return Value

Type: equals_t

true if both ranges are identical

Examples

Compares this instance with rhs. An empty range is considered to be < all non-empty ranges. Otherwise, the comparison always considers the range's minimum value before comparing the maximum value.

Params: rhs = instance to compare with this

Returns: a value less than 0 if this < rhs, a value greater than 0 if this > rhs or 0 if this == rhs.

// empty < smallest range
test!("<")(This.init, This(0, 0));

// smallest range, empty
test!(">")(This(0, 0), This.init);

// a, b
test!("<")(This(0, 1), This(2, 3));

// a, b
test!(">")(This(2, 3), This(0, 1));

// a, b (overlapping)
test!("<")(This(0, 1), This(1, 2));

// a, b (overlapping)
test!(">")(This(1, 2), This(0, 1));

// a, b and a.min == b.min
test!("<")(This(1, 3), This(1, 5));

// a, b and a.min == b.min
test!(">")(This(1, 5), This(1, 3));

Meta