RawFillInto method

Pointer<T> RawFillInto(
  1. int count,
  2. void init(
    1. int,
    2. T
    )
)

Allocates an unslotted array of count structs, populating each via init(i, struct) which writes directly into the native memory.

The caller is responsible for freeing the returned pointer.

Implementation

Pointer<T> RawFillInto(int count, void Function(int, T) init) {
  final p = Raw(count);
  for (int i = 0; i < count; i++) init(i, indexerFunc(p, i));
  return p;
}