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.
r = engine->RegisterGlobalFunction(
"T Test<T, U>(T t, U u)",
asFUNCTION(ScriptTestGen),
asCALL_GENERIC); assert( r >= 0 );
@ asCALL_GENERIC
A function using the generic calling convention.
#define asFUNCTION(f)
Returns an asSFuncPtr representing the function specified by the name.
- Note
- Template functions do not yet support template specializations, so it is not possible to use ordinary functions that have the same function signature.