Files
UnrealEngine/Engine/Source/Runtime/AutoRTFM/Private/ScopedGuard.h
2025-05-18 13:04:45 +08:00

34 lines
466 B
C++

// Copyright Epic Games, Inc. All Rights Reserved.
#pragma once
#if (defined(__AUTORTFM) && __AUTORTFM)
namespace AutoRTFM
{
template<typename T>
class TScopedGuard
{
public:
TScopedGuard(T& Ref, const T& Value)
: OldValue(Ref)
, Ref(Ref)
{
Ref = Value;
}
~TScopedGuard()
{
Ref = OldValue;
}
private:
T OldValue;
T& Ref;
};
} // namespace AutoRTFM
#endif // (defined(__AUTORTFM) && __AUTORTFM)