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));
}
...
}
What is the meaning of
typename FInputAxisHandlerSignature::TUObjectMethodDelegate< UserClass >::FMethodPtr
I knowFInputAxisHandlerSignature::TUObjectMethodDelegate< UserClass >::FMethodPtr
is a type but whytypename
is in there?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)