Function pointers in C++ BindAction

Hi, I was wondering why do we & in the last parameter when mentioning the function name? Is that a pointer to function? Were can I read more about it?

What will BindAction do with the address of the function?

template<class UserClass>
FInputActionBinding & BindAction
(
    const FName ActionName,
    const EInputEvent KeyEvent,
    UserClass * Object,
    typename FInputActionHandlerWithKeySignature::TUObjectMethodDelegate< UserClass >::FMethodPtr Func
)

It is merely returning a reference to the FInputActionBinding structure.

Without the &, it would be returning a copy. They could have used a pointer instead of an reference, but that would imply it could return NULL.

You can see it used else where (in SplineComponent.h)
const FInterpCurveVector& GetSplinePointsPosition() const { return SplineCurves.Position; }

Your are right the & gives the address of your function to the BindAction. It needs the address to dynamically call your function at runtime. The & works on functions aswell as on any other variable. If you want to read more about function pointers you can check this out for some examples. This is a very simple c++ concept though, there is not much to be read about. The only thing that you will maybe have problems with is the way the type of a function pointer is written (it is bananas).

It it were reference not address(pointer)…wouldn’t it have been just Function name without &

void Foo()
{
}

int main()
{
    void(& func)() = Foo;

    func(); //::Foo();
}

please reply back so I can be sure if it’s a function pointer or function reference

I have already read that guide by alex. I get it…when we don’t know when exactly to call a function. Mostly in case of Events(Mouse click) & stuff. That time we just store the address of function so I can be called when the event occurs. Similarly in this case BindAction event i.e. mouse grab