Function LinkedList.toArray

Convert to array.

T[] toArray();

Example

LinkedList!int list;
scope(exit) list.free();

list.insertBack(1);
list.insertBack(2);
list.insertBack(3);

auto arr = list.toArray();
assert(arr == [1,2,3]);
Delete(arr);

Example

LinkedList!int list;
scope(exit) list.free();

assert(list.byElement().empty);

list.insertBack(1);
list.insertBack(2);
list.insertBack(3);

auto range = list.byElement();
import std.range: isInputRange;
import std.algorithm: equal;
static assert(isInputRange!(typeof(range)));

assert(equal(range, [1, 2, 3]));

range = list.byElement();
auto saved = range.save();
range.popFront();
assert(equal(range, [2, 3]));
assert(equal(saved, [1, 2, 3]));