UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
ScopedGuard.h
Go to the documentation of this file.
1// Copyright Epic Games, Inc. All Rights Reserved.
2
3#pragma once
4
5#if (defined(__AUTORTFM) && __AUTORTFM)
6
7namespace AutoRTFM
8{
9
10template<typename T>
11class TScopedGuard
12{
13public:
14 TScopedGuard(T& Ref, const T& Value)
15 : OldValue(Ref)
16 , Ref(Ref)
17 {
18 Ref = Value;
19 }
20
22 {
23 Ref = OldValue;
24 }
25
26private:
27 T OldValue;
28 T& Ref;
29};
30
31} // namespace AutoRTFM
32
33#endif // (defined(__AUTORTFM) && __AUTORTFM)
UE_FORCEINLINE_HINT TSharedRef< CastToType, Mode > StaticCastSharedRef(TSharedRef< CastFromType, Mode > const &InSharedRef)
Definition SharedPointer.h:127
Definition API.cpp:57
@ Ref
Value is copied out after function call. Only valid on function param declaration.
Definition ObjectMacros.h:1074