Creates a structure of arrays instance with newLength elements.
Returns the number of elements that can be inserted without allocation.
Returns the current capacity - the current length rounded up to a power of two. This assumption allows us to save on having a separate field.
Returns true iff no elements are present.
Given an argument of type T or argument sequence of type Fields!T, inserts the fields of T at the back of the container.
Returns the number of inserted elements.
Returns the array corresponding to the instances of field.
Given a field name, returns its index. Callable at compile-time.
Structure of Arrays
This type constructor turns a structure with any number of fields into a structure with (conceptually) the same number of arrays with minimal overhead (basically two pointers). Even though the implementation uses low-level tricks like pointer-arithmetic, the interface is completely type-safe.
The representation in memory is roughly this: storage = [ [ Fields!T[0], .. ] ... [ Fields!T[$ - 1] .. ] ] (storage is a single memory allocation)
Original at https://gist.github.com/PetarKirov/a074073a12482e761a5e88eec559e5a8