Closed ameaninglessname closed 1 year ago
Because in that case the coroutine would be resumed after its this
(the lambda object) gets destroyed.
The "why not" version breaks the UE5Coro.Aggregate.*
tests in Debug Editor¹, it just gets lucky with how undefined behavior plays out in other configurations (including DebugGame Editor).
This line is in a private test helper that does not affect your project anyway.
¹UE 5.1.0, MSVC 19.34.31937.0, Windows SDK 10.0.22621.755.
auto* Copy = new std::function(std::move(Fn));
Why not just
Fn(...)
to get the co-routine object?