Function List.opAssign

Assigns a new value rhs to the list, replacing its current contents.

void opAssign (
  typeof(null) rhs
) scope;

void opAssign(R) (
  R range
) scope
if (!isList!R && isBtlInputRange!R && is(ElementEncodingType!R : ElementType));

void opAssign(Rhs) (
  auto scope ref Rhs rhs
) scope
if (isList!Rhs && isAssignable!(Rhs, typeof(this)));

Parameter rhs can by type of null, List or input range of ElementType elements.

Examples

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

list = null;
assert(list.empty);

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

list = List!(int).build(4, 2);
assert(list == [4, 2]);