///
@global()
@struct()
class CArray {
constructor(capacity: usize) {
return changetype(Heap.allocate(capacity * sizeof()));
}
@inline()
"[]"(index: usize): T {
return load(changetype(this) + index * sizeof());
}
@inline()
"[]="(index: usize, value: T): T {
store(changetype(this) + index * sizeof(), value);
return value;
}
dispose(): void {
Heap.dispose(changetype(this));
}
}