TFunctionRef<T>
is an Unreal-friendly way of letting you define and use
Lambda functions. If you are unfamiliar with Lambda functions in C++, you
should research what they are first before trying to use the following.
Imagine we have a function that takes a list of items as input, and it performs some actions on each one, and then passes them on to another internal object. We might want to let the user specify a custom initializer function that is called on each item before it is handed off.
We can do this by adding a TFunctionRef<T>
parameter to our function, as
shown below.
With a function definition above, how do we call it and provide a Lambda function that it will accept?