4.23 breaks my Async code...

On upgrading to 4.23 the following doesnt compile:



 TFuture<void> ClientConnectionFinishedFuture;
...
ClientConnectionFinishedFuture = Async(EAsyncExecution::Thread, &](){
  ...
}); 

In fact the code in the Async doc doesnt compile as well:



TUniqueFunction<int()> Task = ]()
{
    return 123;
};
auto Result = Async(EAsyncExecution::Thread, Task);


//Error C2280 ‘TUniqueFunction<void (void)>::TUniqueFunction(const TUniqueFunction<void (void)> &)’: attempting to reference a deleted function

However I fixed it using TFunction instead of TUniqueFunction - not sure what the sideeffects ar ethough…

Sanjit

TUniqueFunction<T> is non-copyable. You need to use explicit move.

What does that mean? :slight_smile:

MoveTemp should help.



TUniqueFunction<int()> Task = ](){ return 123; };

auto Result = Async(EAsyncExecution::Thread, MoveTemp(Task));