Hello,
the AngelScript docs tell the embedder to write template specializations for the array type, so it doesn't have to do these at runtime.
I haven't understood how to properly define template specializations though.
I have tried it like this, but it does not work:
engine->RegisterObjectType("array<int>", 0, asOBJ_REF | asOBJ_GC);
engine->RegisterObjectBehaviour("array<int>", asBEHAVE_FACTORY, "array<int>@ f(int&in)", asFUNCTIONPR(CScriptArray::Create, (asITypeInfo*), CScriptArray*), asCALL_CDECL);
engine->RegisterObjectBehaviour("array<int>", asBEHAVE_FACTORY, "array<int>@ f(int&in, uint length) explicit", asFUNCTIONPR(CScriptArray::Create, (asITypeInfo*, asUINT), CScriptArray*), asCALL_CDECL);
engine->RegisterObjectBehaviour("array<int>", asBEHAVE_FACTORY, "array<int>@ f(int&in, uint length, const T &in value)", asFUNCTIONPR(CScriptArray::Create, (asITypeInfo*, asUINT, void *), CScriptArray*), asCALL_CDECL);
engine->RegisterObjectBehaviour("array<int>", asBEHAVE_LIST_FACTORY, "array<int>@ f(int&in type, int&in list) {repeat int}", asFUNCTIONPR(CScriptArray::Create, (asITypeInfo*, void*), CScriptArray*), asCALL_CDECL);