UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
TGuardValue< RefType, AssignedType > Struct Template Reference

#include <UnrealTemplate.h>

+ Inheritance diagram for TGuardValue< RefType, AssignedType >:

Public Member Functions

 TGuardValue (RefType &ReferenceValue, const AssignedType &NewValue)
 
 ~TGuardValue ()
 
UE_FORCEINLINE_HINT const AssignedTypeGetOriginalValue () const
 

Detailed Description

template<typename RefType, typename AssignedType = RefType>
struct TGuardValue< RefType, AssignedType >

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.

Constructor & Destructor Documentation

◆ TGuardValue()

template<typename RefType , typename AssignedType = RefType>
TGuardValue< RefType, AssignedType >::TGuardValue ( RefType &  ReferenceValue,
const AssignedType NewValue 
)
inline

◆ ~TGuardValue()

template<typename RefType , typename AssignedType = RefType>
TGuardValue< RefType, AssignedType >::~TGuardValue ( )
inline

Member Function Documentation

◆ GetOriginalValue()

template<typename RefType , typename AssignedType = RefType>
UE_FORCEINLINE_HINT const AssignedType & TGuardValue< RefType, AssignedType >::GetOriginalValue ( ) const
inline

Provides read-only access to the original value of the data being tracked by this struct

Returns
a const reference to the original data value

The documentation for this struct was generated from the following file: