Iterating over list via foreach.
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]);
See Implementation
Iterating over list via foreach.