MCPcopy Create free account
hub / github.com/FlaxEngine/FlaxEngine / Resize

Method Resize

Source/Engine/Core/Collections/Array.h:401–413  ·  view source on GitHub ↗

Resizes the collection to the specified size. If the size is equal or less to the current capacity no additional memory reallocation in performed. The new collection size. True if preserve collection data when changing its size, otherwise collection after resize might not contain the previous data.

Source from the content-addressed store, hash-verified

399 /// <param name="size">The new collection size.</param>
400 /// <param name="preserveContents">True if preserve collection data when changing its size, otherwise collection after resize might not contain the previous data.</param>
401 void Resize(const int32 size, const bool preserveContents = true)
402 {
403 if (_count > size)
404 {
405 Memory::DestructItems(_allocation.Get() + size, _count - size);
406 }
407 else
408 {
409 EnsureCapacity(size, preserveContents);
410 Memory::ConstructItems(_allocation.Get() + _count, size - _count);
411 }
412 _count = size;
413 }
414
415 /// <summary>
416 /// Ensures the collection has given capacity (or more).

Callers 2

ReleaseMethod · 0.45
MergeSortFunction · 0.45

Calls 2

EnsureCapacityFunction · 0.85
GetMethod · 0.45

Tested by

no test coverage detected