LinkedList.opApply

Iterating over list via foreach.

  1. int opApply(int delegate(size_t, ref T) dg)
  2. int opApply(int delegate(ref T) dg)
    struct LinkedList(T, bool ordered = true)
    int
    opApply
    (
    scope int delegate
    (
    ref T
    )
    dg
    )

Examples

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]);

Meta