SetTimer() signature, if you follow that signature it's wrong, but if you do it wrong, it's right

The first parameter of the SetTimer() method, according to the signature we’re using is designated as FTimerHandle &InOutHandle, leading me to believe that we’re needing to use a reference of type FTimerHandle here. But the way Ben does it is…

FTimerHandle Timer;
GetWorld()->GetTimerManager().SetTimer(Timer, …

…and since there’s no ampersand in front of Timer, I’m lead to believe that we’re declaring a variable Timer in the first line and using a copy of that variable as the first argument of the SetTimer() function in the 2nd line.
Why does it work this way??? Why is it that what I learned before is turned upside down?

Note that if you do it the right way, like this…

GetWorld()->GetTimerManager().SetTimer(FTimerHandle &Timer,…

…it doesn’t compile.

Privacy & Terms