How to use TGuard expression?
I see the following in CharacterMovementComponent.cpp
TGuardValue<FVector> RestoreAcceleration(Acceleration, FVector::ZeroVector);
TGuardValue<FVector> RestoreVelocity(Velocity, Velocity);
I don’t understand what its doing and why
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
GuardSomeBool(bSomeBool, false); ///
Sets bSomeBool to false, and restores
it in dtor.
Meh!. dtor is abbrevation for destructor