TGuardValue

Exception-safe guard around saving/restoring a value.

Windows
MacOS
Linux

Inheritance Hierarchy

References

Module

Core

Header

/Engine/Source/Runtime/Core/Public/Templates/UnrealTemplate.h

Include

#include "Templates/UnrealTemplate.h"

Syntax

template<typename RefType, typename AssignedType>
struct TGuardValue : private FNoncopyable

Remarks

Exception-safe guard around saving/restoring a value. Commonly used to make sure a value is restored even if the code early outs in the future. Usage: TGuardValue<bool> GuardSomeBool(bSomeBool, false); // Sets bSomeBool to false, and restores it in dtor.

Constructors

Name Description

Public function

TGuardValue

(
    RefType& ReferenceValue,
    const AssignedType& NewValue
)

Destructors

Name Description

Public function

~TGuardValue()

Operators

Name Description

Public function Const

const Assign...

 

operator*()

Overloaded dereference operator.

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