DList.insertAfter

Inserts new elements after r.

  1. size_t insertAfter(Range r, R el)
    struct DList(T)
    @trusted
    size_t
    insertAfter
    (
    R
    )
    (,
    R el
    )
  2. size_t insertAfter(Range r, T el)
  3. size_t insertAfter(Range r, R el)
  4. size_t insertAfter(Range r, T[R] el)

Parameters

R

Type of the inserted value(s).

r Range

Range extracted from this list.

el R

New element(s).

Return Value

Type: size_t

The number of elements inserted.

Precondition: r is extracted from this list.

Examples

auto l1 = DList!int([5, 234, 1]);
auto l2 = DList!int([5, 1]);
auto r = l2[];
r.popBack();
l2.insertAfter(r, 234);
assert(l1 == l2);
auto l1 = DList!int([5, 1, 234]);
auto l2 = DList!int([5, 1]);
int var = 234;

l2.insertAfter(l2[], var);
assert(l1 == l2);
auto l1 = DList!int([5, 234, 30, 1]);
auto l2 = DList!int([5, 1]);
auto r = l2[];

r.popBack();
l2.insertAfter(r, [234, 30]);
assert(l1 == l2);

Meta