Hi guys, I am a UE4 and C++ beginner coming from the Java world. As of version 8, Java supports lambda expressions and method references. There are code parts in C++ which look pretty similar.
I guess &AMyClass::Foo is a reference (pointer) to the method Foo of the class AMyClass, which is being run for this by the implementation of the SetTimer(...) method. Am I right?
Therefore, I assume that we have a different technical approach than in Java, since Java lambda expressions are based on implementations of functional interfaces. In Java, we have object instances and therefore known method signatures, in C++, we have a pointer to a method, but the method signature, or at least the parameter list, is unknown, right?
Is it still possible to somehow pass a variable to &AMyClass::Foo as a method parameter?
Where the [param] part is called capture, that allows you to capture any variables from the outer scope into the lambda function either by copy (which is the default) or by reference using [¶m].
Of course you can also capture this which allows you to call a member function with param in the lambda:
World->GetTimerManager().SetTimer(TimerHandle, [this, param](){this->foo(param);}, 1.f);
// which is then similar to your java example
world.getTimerManager().setTimer(timerHandle, () -> foo(param), 1.0f);