TArray — deprecated bool shrinking overloads
Deprecated: Use the EAllowShrinking enum overload instead of the bool bAllowShrinking parameter.
#include "Containers/Array.h"
Access: public
Specifiers: deprecated
Description
Documents the UE 5.6 deprecation of bool-based shrinking overloads on TArray methods. Several TArray methods (Pop, RemoveAt, RemoveAtSwap, SetNum, etc.) had overloads accepting a raw bool bAllowShrinking argument; these are all deprecated in 5.6 in favour of the EAllowShrinking enum.
Caveats & Gotchas
- • Any code passing a bare true/false as the shrinking argument to Pop, RemoveAt, RemoveAtSwap, or SetNum will produce a UE_DEPRECATED compiler warning in 5.6. Replace with EAllowShrinking::Yes or EAllowShrinking::No.
- • The macro expands to UE_DEPRECATED(5.6, "...") so the deprecation warning fires at the call site, not inside TArray — meaning third-party plugins that haven't been updated will also emit warnings when compiled against 5.6 headers.
- • The enum-based overloads exist since at least 5.5; you can safely migrate code without dropping engine version support mid-project.
Signature
UE_ALLOWSHRINKING_BOOL_DEPRECATED("Pop")
UE_NODEBUG UE_FORCEINLINE_HINT ElementType Pop(bool bAllowShrinking) Example
Migrating from bool to EAllowShrinking C++
// Before (deprecated in 5.6):
MyArray.RemoveAt(Index, 1, false);
MyArray.SetNum(10, true);
// After:
MyArray.RemoveAt(Index, 1, EAllowShrinking::No);
MyArray.SetNum(10, EAllowShrinking::Yes); Version History
Introduced in: 5.6
| Version | Status | Notes |
|---|---|---|
| 5.6 | deprecated | Bool overloads deprecated; use EAllowShrinking enum. |
Feedback
Was this helpful?