diff options
| author | aura <nw@moneybot.cc> | 2026-03-13 05:03:12 +0100 |
|---|---|---|
| committer | aura <nw@moneybot.cc> | 2026-03-13 05:03:12 +0100 |
| commit | d42d218a3685c030a7370d30f2de5495ea526d99 (patch) | |
| tree | f2486a670fec9b2eb8a55fac1ba1c85dc8ca1dc5 /src/util/allocator.h | |
| parent | ae6718ec0fb21077b767e189aca26b0fed488775 (diff) | |
wip on props
Diffstat (limited to 'src/util/allocator.h')
| -rw-r--r-- | src/util/allocator.h | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/util/allocator.h b/src/util/allocator.h index 8b159da..0cb8fa2 100644 --- a/src/util/allocator.h +++ b/src/util/allocator.h @@ -83,7 +83,10 @@ struct LIST { capacity = _size; } + LIST( const LIST<T>& other ) { + if( this == &other ) return; + if( !other.capacity || !other.size ) { capacity = 1; size = 0; @@ -108,8 +111,13 @@ struct LIST { if( this == &other ) return *this; - if( data && data != other.data ) + if( data && data != other.data ) { + if constexpr( !__is_trivially_destructible(T) ) { + for( U32 i = 0; i < size; i++ ) + data[i].~T(); + } free( data ); + } data = 0; @@ -142,6 +150,8 @@ struct LIST { } if( data ) free( data ); + size = 0; + data = 0; } T at( U32 index ) { |
