diff options
| author | navewindre <boneyaard@gmail.com> | 2025-09-10 12:25:00 +0200 |
|---|---|---|
| committer | navewindre <boneyaard@gmail.com> | 2025-09-10 12:25:00 +0200 |
| commit | 235926dadb686589f0b5480162c3ab929159e570 (patch) | |
| tree | 9fc482720a2bafabaca207befbc611d373d1c7ca /src/util/allocator.h | |
| parent | 8be4ca70798fafd57dba947edfb18d0de594013d (diff) | |
unfuck
Diffstat (limited to 'src/util/allocator.h')
| -rw-r--r-- | src/util/allocator.h | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/util/allocator.h b/src/util/allocator.h index ee0ddd8..7927b9c 100644 --- a/src/util/allocator.h +++ b/src/util/allocator.h @@ -161,6 +161,18 @@ struct LIST { return &data[size - 1]; } + void resize( U32 size ) { + if( size > capacity ) + reserve( size * 2 ); + + if( size < capacity ) { + for( U32 i = size; i < capacity; ++i ) + data[i] = T(); + } + + this->size = size; + } + // does not call copy constructors, raw memcpy void emplace_list( const LIST<T>& list ) { if( !list.size ) |
