/// /** A C-compatible Array class. */ @global() class CArray { /** Constructs a new C-Array of the specified capacity. */ constructor(capacity: usize) { return unsafe_cast(Memory.allocate(capacity * sizeof())); } /** Gets the element at the specified index using bracket notation. */ @inline() "[]"(index: usize): T { return load(unsafe_cast(this) + index * sizeof()); } /** Sets the element at the specified index using bracket notation. */ @inline() "[]="(index: usize, value: T): T { store(unsafe_cast(this) + index * sizeof(), value); return value; } /** Disposes this instance and the memory associated with it. */ dispose(): void { Memory.dispose(unsafe_cast(this)); } }