LinkedList.opApply - multiple declarations
Function LinkedList.opApply
Iterating over list via foreach.
int opApply
(
scope int delegate(size_t, ref T) dg
);
Example
LinkedList!int list;
scope(exit) list .free();
list .append(1);
list .append(2);
list .append(3);
list .append(4);
int[4] values;
foreach(size_t i, ref int val; list) {
values[i] = val;
}
assert(values[] == [1,2,3,4]);
Function LinkedList.opApply
Iterating over list via foreach.
int opApply
(
scope int delegate(ref T) dg
);
Example
LinkedList!int list;
scope(exit) list .free();
list .append(1);
list .append(2);
list .append(3);
list .append(4);
int[] values;
foreach(ref int val; list) {
values ~= val;
}
assert(values[] == [1,2,3,4]);