Download

what the meaning of the code??

AssertionMacros.h 208-233

namespace UE4Asserts_Private
{
// A junk function to allow us to use sizeof on a member variable which is potentially a bitfield
template <typename T>
bool GetMemberNameCheckedJunk(const T&);
template <typename T>
bool GetMemberNameCheckedJunk(const volatile T&);
}

// Returns FName(TEXT(“EnumeratorName”)), while statically verifying that the enumerator exists in the enum
#define GET_ENUMERATOR_NAME_CHECKED(EnumName, EnumeratorName)
((void)sizeof(UE4Asserts_Private::GetMemberNameCheckedJunk(EnumName::EnumeratorName)), FName(TEXT(#EnumeratorName)))

// Returns FName(TEXT(“MemberName”)), while statically verifying that the member exists in ClassName
#define GET_MEMBER_NAME_CHECKED(ClassName, MemberName)
((void)sizeof(UE4Asserts_Private::GetMemberNameCheckedJunk(((ClassName*)0)->MemberName)), FName(TEXT(#MemberName)))

#define GET_MEMBER_NAME_STRING_CHECKED(ClassName, MemberName)
((void)sizeof(UE4Asserts_Private::GetMemberNameCheckedJunk(((ClassName*)0)->MemberName)), TEXT(#MemberName))

// Returns FName(TEXT(“FunctionName”)), while statically verifying that the function exists in ClassName
#define GET_FUNCTION_NAME_CHECKED(ClassName, FunctionName)
((void)sizeof(&ClassName::FunctionName), FName(TEXT(#FunctionName)))

#define GET_FUNCTION_NAME_STRING_CHECKED(ClassName, FunctionName)
((void)sizeof(&ClassName::FunctionName), TEXT(#FunctionName))

(void) is for eliminate a warning
what is the role of sizeof and the template function???
i have think for three days,It seems to be deleted…

I think sizeof is used to ensure that function with the given name is declared in C++ code. If not, that sizeof will not compile.