MCRO
C++23 utilities for Unreal Engine.
|
#include <Once.h>
Public Member Functions | |
FORCEINLINE | FOnce () |
FORCEINLINE | FOnce (const FOnce &from) |
FORCEINLINE | FOnce (FOnce &&from) noexcept |
FORCEINLINE | operator bool () |
FORCEINLINE bool | IsTriggered () const |
FORCEINLINE void | Reset () |
Used for lambdas which supposed to run only once. The first time it is converted to bool it returns true but every other times it will return false. Usage: using namespace BaseUtils; SomeEvent.AddLambda([once = FOnce()] { // Just use it inside a condition if (once) { ... } // exploiting short-circuit: if (MyCondition && once) { ... } // but this will not produce the expected result: if (once && MyCondition) { ... } // BAD }
|
inline |
|
inlinenoexcept |
|
inline |