Ark Server API (ASA) - Wiki
Loading...
Searching...
No Matches
TGuardValue< RefType, AssignedType > Struct Template Reference

#include <UnrealTemplate.h>

+ Inheritance diagram for TGuardValue< RefType, AssignedType >:
+ Collaboration diagram for TGuardValue< RefType, AssignedType >:

Public Member Functions

 TGuardValue (RefType &ReferenceValue, const AssignedType &NewValue)
 
 ~TGuardValue ()
 
FORCEINLINE const AssignedTypeoperator* () const
 

Private Attributes

RefTypeRefValue
 
AssignedType OldValue
 

Additional Inherited Members

- Private Member Functions inherited from FNoncopyable
 FNoncopyable ()
 
 ~FNoncopyable ()
 

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.

Definition at line 325 of file UnrealTemplate.h.

Constructor & Destructor Documentation

◆ TGuardValue()

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

Definition at line 327 of file UnrealTemplate.h.

◆ ~TGuardValue()

Definition at line 332 of file UnrealTemplate.h.

Member Function Documentation

◆ operator*()

Overloaded dereference operator. 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

Definition at line 343 of file UnrealTemplate.h.

Member Data Documentation

◆ OldValue

template<typename RefType , typename AssignedType = RefType>
AssignedType TGuardValue< RefType, AssignedType >::OldValue
private

Definition at line 350 of file UnrealTemplate.h.

◆ RefValue

template<typename RefType , typename AssignedType = RefType>
RefType& TGuardValue< RefType, AssignedType >::RefValue
private

Definition at line 349 of file UnrealTemplate.h.


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