RawFillWith method

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

Allocates an unslotted array of count structs, setting each element to the T returned by init(ptr, i).

The caller is responsible for freeing the returned pointer.

Implementation

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