Function List.opEquals

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

bool opEquals (
  typeof(null) nil
) const pure nothrow @nogc scope @safe;

bool opEquals(R) (
  scope R rhs
) const nothrow scope
if (isBtlInputRange!R && !isList!R);

bool opEquals(L) (
  auto scope const ref L rhs
) const nothrow scope
if (isList!L);

Returns true if they are equal, false otherwise

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);