#ifndef ARRAY_CC #define ARRAY_CC #include "memory.cc" #define ARRAY_INIT 4 #define ARRAY_GROWTH 2 template struct Array { Slice buffer; const Allocator* allocator; }; #define array_init(T, allocator) Array{Slice{}, allocator} template void array_deinit(Array* array) { assert(array != nullptr); if(unlikely(array->allocator == nullptr)) return; slice_deallocate(array->allocator, &array->buffer); array->allocator = nullptr; } #endif