DList.insertBack

Inserts a new element at the end.

  1. size_t insertBack(R el)
  2. size_t insertBack(R el)
  3. size_t insertBack(R el)
  4. size_t insertBack(T[R] el)
    struct DList(T)
    size_t
    insertBack
    (
    size_t R
    )
    (
    T[R] el
    )
  5. alias insert = insertBack

Parameters

R

Type of the inserted value(s).

el T[R]

New element(s).

Return Value

Type: size_t

The number of elements inserted.

Examples

DList!int l;
int value = 5;

l.insertBack(value);
assert(l.front == value);
assert(l.back == value);

value = 8;
l.insertBack(value);
assert(l.front == 5);
assert(l.back == value);
DList!int l1;

assert(l1.insertBack(8) == 1);
assert(l1.back == 8);
assert(l1.insertBack(9) == 1);
assert(l1.back == 9);

DList!int l2;
assert(l2.insertBack([25, 30, 15]) == 3);
assert(l2.back == 15);

l2.insertBack(l1[]);
assert(l2.back == 9);

Meta