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

Function SetCapacity

Source/Engine/Core/Collections/BitArray.h:249–258  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

247 /// <param name="capacity">The new capacity.</param>
248 /// <param name="preserveContents">True if preserve collection data when changing its size, otherwise collection after resize will be empty.</param>
249 void SetCapacity(const int32 capacity, const bool preserveContents = true)
250 {
251 if (capacity == _capacity)
252 return;
253 ASSERT(capacity >= 0);
254 const int32 count = preserveContents ? (_count < capacity ? _count : capacity) : 0;
255 _allocation.Relocate(ToItemCapacity(capacity), ToItemCount(_count), ToItemCount(count));
256 _capacity = capacity;
257 _count = count;
258 }
259
260 /// <summary>
261 /// 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 8

HashSetFunction · 0.70
HashSet.hFile · 0.70
EnsureCapacityMethod · 0.70
EnsureCapacityFunction · 0.70
EnsureCapacityMethod · 0.70
EnsureCapacityMethod · 0.70
DictionaryFunction · 0.70
Dictionary.hFile · 0.70

Calls 1

RelocateMethod · 0.45

Tested by

no test coverage detected