List.opAssign

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

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

  1. void opAssign(typeof(null) rhs)
  2. void opAssign(R range)
  3. void opAssign(Rhs rhs)
    struct List
    scope
    void
    opAssign
    (
    Rhs
    )
    (
    scope auto ref Rhs rhs
    )
    if (
    isList!Rhs &&
    isAssignable!(Rhs, typeof(this))
    )

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

Meta