SList.insert

Inserts a new element at the beginning.

Return Value

The number of elements inserted.

Examples

SList!int l;
int value = 5;

l.insertFront(value);
assert(l.front == value);

value = 8;
l.insertFront(value);
assert(l.front == 8);
SList!int l1;

assert(l1.insertFront(8) == 1);
assert(l1.front == 8);
assert(l1.insertFront(9) == 1);
assert(l1.front == 9);

SList!int l2;
assert(l2.insertFront([25, 30, 15]) == 3);
assert(l2.front == 25);

l2.insertFront(l1[]);
assert(l2.front == 9);

Meta