MCRO
C++23 utilities for Unreal Engine.
|
#include <Finally.h>
Public Member Functions | |
FFinally (TUniqueFunction< void()> &&payload) | |
FFinally (FFinally &&from) noexcept | |
~FFinally () | |
Run arbitrary finalizers on destruction. It has similar purpose to ON_SCOPE_EXIT, however FFinally can be moved around into different scopes, Payload will be only executed if the finalizer hasn't been moved from, otherwise the payload will be ignored in the source of move assignments:
{ FFinally fin([] {...}) Async(EAsyncExecution::ThreadPool, [fin = MoveTemp(fin)] { // Payload is executed at the end of this scope } // Payload is not executed here }
Finalizers can be moved into nested scopes
{ FFinally fin([] {...}) Async(EAsyncExecution::ThreadPool, [fin = MoveTemp(fin)] mutable { AsyncTask(ENamedThreads::GameThread, [fin = MoveTemp(fin)] { // Payload is executed at the end of this scope } // Payload is not executed here } // Payload is not executed here }
|
inline |
|
inlinenoexcept |