0

I was looking at unreal engine 4 source code and found two functions which look like this

template<class UserClass>
FInputAxisBinding& BindAxis( const FName AxisName, UserClass* Object, typename FInputAxisHandlerSignature::TUObjectMethodDelegate<UserClass>::FMethodPtr Func )
{
   FInputAxisBinding AB( AxisName );
   AB.AxisDelegate.BindDelegate(Object, Func);
   AxisBindings.Emplace(MoveTemp(AB));
   return AxisBindings.Last();
}
template<class DelegateType, class DynamicDelegateType>
struct TInputUnifiedDelegate
{ 
...
    template< class UserClass >
    inline void BindDelegate(UserClass* Object, 
typename DelegateType::template TUObjectMethodDelegate<UserClass>::FMethodPtr Func)
{
   FuncDynDelegate.Reset();
   FuncDelegate = MakeShared<DelegateType>(DelegateType::CreateUObject(Object, Func));
}
...
}
  1. What is the meaning of typename FInputAxisHandlerSignature::TUObjectMethodDelegate< UserClass >::FMethodPtr I know FInputAxisHandlerSignature::TUObjectMethodDelegate< UserClass >::FMethodPtr is a type but why typename is in there?

  2. In DelegateType::template TUObjectMethodDelegate<UserClass>::FMethodPtr Func what is the meaning of 'template' in this context and why there are two spaces? (after template and before Func)

WUT
  • 1
  • 1

0 Answers0