SList.insertBefore

Inserts elements from a static array before r.

  1. size_t insertBefore(Range r, R el)
  2. size_t insertBefore(Range r, R el)
  3. size_t insertBefore(Range r, T el)
  4. size_t insertBefore(Range r, T[R] el)
    struct SList(T)
    size_t
    insertBefore
    (
    size_t R
    )
    (,
    T[R] el
    )

Parameters

R

Static array size.

r Range

Range extracted from this list.

el T[R]

New elements.

Return Value

Type: size_t

The number of elements inserted.

Precondition: r is extracted from this list.

Examples

auto l1 = SList!int([5, 234, 30, 1]);
auto l2 = SList!int([5, 1]);
auto r = l2[];
r.popFront();
l2.insertBefore(r, [234, 30]);
assert(l1 == l2);

Meta