Lets a Soa be used in a for loop over its N elements; it is a copy of the element and it_index its index.
With for *, it points to a temporary copy that is stored back into the array after each pass of the body,
so changes through it stick, but it is not a pointer into the arrays and must not be kept. Reverse
iteration is not supported.
Pair :: struct { a: int; b: int; }
values: Soa(Pair, 2);
for *pair, index: values pair.a = index + 10;
total := 0;
for pair: values total += pair.a;
assert(total == 21);for_expansion :: (array: *$S/Soa, body: Code, flags: For_Flags)
Parameters
- array: *$S/Soa
- body: Code
- flags: For_Flags