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

Method SetCapacity

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

Changes the capacity of the collection. The new capacity. True if preserve collection data when changing its size, otherwise collection after resize will be empty.

Source from the content-addressed store, hash-verified

383 /// <param name="capacity">The new capacity.</param>
384 /// <param name="preserveContents">True if preserve collection data when changing its size, otherwise collection after resize will be empty.</param>
385 void SetCapacity(const int32 capacity, const bool preserveContents = true)
386 {
387 if (capacity == _capacity)
388 return;
389 ASSERT(capacity >= 0);
390 const int32 count = preserveContents ? (_count < capacity ? _count : capacity) : 0;
391 _allocation.Relocate(capacity, _count, count);
392 _capacity = capacity;
393 _count = count;
394 }
395
396 /// <summary>
397 /// Resizes the collection to the specified size. If the size is equal or less to the current capacity no additional memory reallocation in performed.

Callers

nothing calls this directly

Calls 1

RelocateMethod · 0.45

Tested by

no test coverage detected