List.emplaceBack

Appends a new element to the end of the bidirectional list. The element is constructed through emplace.

struct List
scope return
void
emplaceBack
(
Args...
)
(
auto ref Args args
)

Examples

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

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

    list.emplaceBack();
    assert(list == [1, 2, 3, 42, 0]);
}

{
    static struct Foo{
        int i;
        string str;
    }

    auto list = List!(Foo).build(Foo(1, "A"));

    list.emplaceBack(2, "B");
    assert(list == only(Foo(1, "A"), Foo(2, "B")));
}

Meta