RawFillWith method

P RawFillWith(
  1. int count,
  2. V init(
    1. P,
    2. int
    )
)

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

The caller is responsible for freeing the returned pointer.

Implementation

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