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)
    struct List
    const scope pure nothrow @safe @nogc
    bool
    opEquals
    (
    typeof(null) nil
    )
  2. bool opEquals(R rhs)
  3. bool opEquals(L rhs)

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