Template functions can be implemented with the generic calling convention and registered with the engine either as global functions or as class methods.
Once the template function is called, the function can determine the type of the arguments using the asIScriptGeneric::GetArgTypeId, or alternatively with asIScriptFunction::GetSubTypeId.