List.opEquals

Compares the contents of a list with another list, range or null.

Returns true if they are equal, false otherwise

  1. bool opEquals(typeof(null) nil)
  2. bool opEquals(R rhs)
  3. bool opEquals(L rhs)
    struct List
    const scope nothrow
    bool
    opEquals
    (
    L
    )
    (
    scope const auto ref L rhs
    )
    if ()

Examples

List!(int) list = List!(int).build(1, 2, 3);

assert(list != null);
assert(null != list);

assert(list == [1, 2, 3]);
assert([1, 2, 3] == list);

assert(list == typeof(list).build(1, 2, 3));
assert(typeof(list).build(1, 2, 3) == list);

import std.range : only;
assert(list == only(1, 2, 3));
assert(only(1, 2, 3) == list);

Meta