FVMReflection::operator,

Allows an inline method of returning the error status - the comma operator has the lowest precedence, so is executed last.

Windows
MacOS
Linux

References

Module

NetcodeUnitTest

Header

/Engine/Plugins/NetcodeUnitTest/NetcodeUnitTest/Source/NetcodeUnitTest/Public/NUTUtilReflection.h

Include

#include "NUTUtilReflection.h"

Source

/Engine/Plugins/NetcodeUnitTest/NetcodeUnitTest/Source/NetcodeUnitTest/Private/NUTUtilReflection.cpp

Syntax

FVMReflection & operator,
(
    bool * bErrorPointer
)

Remarks

Allows an inline method of returning the error status - the comma operator has the lowest precedence, so is executed last.

This also allows you to test for errors at every stage of reflection (although it's a bit ugly if done this way), e.g: UObject* Result = (UObject*)(((FVMReflection(TestObjA), &bError)->*"AObjectRef", &bErrorA)->*"BObjectRef", &bErrorB);

Since the operator specifies a bool pointer though, we don't want to hold onto this pointer longer than necessary (in case it becomes a dangling pointer), so it is unset every time an operator returns (with the exception of this operator).

This means both, that you can use error bools to catch errors from within specific parts of a statement, while also avoiding invalid memory access: (Cast)((->*"Blah", &bError)->*"Boo"): Returns errors accessing 'Blah', but not 'Boo' or 'Cast'

It also means, that if you specify a bool right at the end of a reflection statement, before casting to a return type, that you can use this last reflection statement to detect casting errors too: (Cast)(->*"Blah"->*"Boo", &bError): Returns errors accessing Blah, Boo, or with Cast

Help shape the future of Unreal Engine documentation! Tell us how we're doing so we can serve you better.
Take our survey
Dismiss