34 check(StructMemory !=
nullptr);
35 check(ScriptStruct !=
nullptr);
37 TEXT(
"Incompatible struct types: Cannot cast '%s' to '%s'"),
40 return *((T*)StructMemory);
47 if (StructMemory !=
nullptr
52 return ((T*)StructMemory);
58 template<
typename T,
typename BaseStructT>
61 if constexpr (std::is_same_v<BaseStructT, std::decay_t<T>>)
63#if WITH_EDITOR || !UE_BUILD_SHIPPING
64 if (StructMemory && ScriptStruct)
68 TEXT(
"Incompatible struct types: Cannot cast '%s' to '%s'. Falling back to return nullptr, but this may crash in shipping!"), *ScriptStruct->
GetPathName(), *
TBaseStructure<T>::Get()->GetPathName()))
70 return ((T*)StructMemory);
75 return ((T*)StructMemory);
99 template<
typename T,
typename BaseStructT>
#define ensureAlwaysMsgf(InExpression, InFormat,...)
Definition AssertionMacros.h:467
#define check(expr)
Definition AssertionMacros.h:314
#define checkf(expr, format,...)
Definition AssertionMacros.h:315
UE_FORCEINLINE_HINT TSharedRef< CastToType, Mode > StaticCastSharedRef(TSharedRef< CastFromType, Mode > const &InSharedRef)
Definition SharedPointer.h:127
COREUOBJECT_API FString GetPathName(const UObject *StopOuter=NULL) const
Definition UObjectBaseUtility.cpp:38
bool IsChildOf() const
Definition Class.h:788
Definition PropertyBag.cpp:61
void CheckWrapperType()
Definition StructUtils.h:21
void CheckStructType()
Definition StructUtils.h:11
void CalcMidIndexAndCount(int32 ArrayNum, int32 &InOutIndex, int32 &InOutCount)
Definition StructUtils.h:109
T * GetStructPtr(const UScriptStruct *ScriptStruct, void *StructMemory)
Definition StructUtils.h:45
T & GetStructRef(const UScriptStruct *ScriptStruct, void *StructMemory)
Definition StructUtils.h:32
static constexpr UE_FORCEINLINE_HINT T Clamp(const T X, const T MinValue, const T MaxValue)
Definition UnrealMathUtility.h:592
Definition UnrealTypeTraits.h:40