diff options
Diffstat (limited to 'common')
-rw-r--r-- | common/almalloc.h | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/common/almalloc.h b/common/almalloc.h index 3fc979c9..ca92316a 100644 --- a/common/almalloc.h +++ b/common/almalloc.h @@ -223,6 +223,11 @@ struct FlexArray { const index_type mSize; alignas(alignment) element_type mArray[0]; + static std::unique_ptr<FlexArray> Create(index_type count) + { + void *ptr{al_calloc(alignof(FlexArray), Sizeof(count))}; + return std::unique_ptr<FlexArray>{new (ptr) FlexArray{count}}; + } static constexpr index_type Sizeof(index_type count, index_type base=0u) noexcept { return base + |