Description
Stores the number of elements the array can hold before a reallocation is needed. Accessed publicly via Max(). The difference (ArrayMax - ArrayNum) is the current slack.
Caveats & Gotchas
- • ArrayMax can equal ArrayNum (zero slack) without triggering a reallocation immediately; reallocation happens on the next Add call. Do not assume ArrayMax > ArrayNum after a Reserve call completes if the requested capacity already matched.
- • When a timer is paused, ExpireTime is re-based; similarly, ArrayMax is only updated during reallocation. Calling Shrink() sets ArrayMax == ArrayNum by reallocating to the exact current count.
Signature
SizeType ArrayMax Example
Check allocated capacity C++
TArray<FVector> Points;
Points.Reserve(100);
// Max() returns the allocated capacity; Num() is still 0
UE_LOG(LogTemp, Log, TEXT("Capacity: %d, Count: %d"), Points.Max(), Points.Num()); See Also
Tags
Version History
Introduced in: 4.0
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?