   AngelScript - Template Binding Question
  Hi, I am working on exposing our game engine to AngelScript.Our engine uses the irrlicht rendering engine which uses class templates things such as the strings. We usually use stringw which is defined as:typedef string<wchar_t> stringw; If I want to expose stringc to angelscript, do I need to register it as a class or as a template? The reason I am confused is because the template already has a defined type. Thanks   
  You can only register template instances, as C++ templates are not real code that can be executed. Only when the template is instanciated with a type does the compiler produce the code that can be executed.The AngelScript templates mimics the C++ templates when seen from the scripts, but they are not true C++ templates. Instead the AngelScript templates are implemented as generic dynamic containers.You would register the stringw class as any other class. In fact you can take a look at how the std::string is registered in the ScriptStdString add-on. Regards,Andreas   ;Quote:Original post by WitchLordYou can only register template instances, as C++ templates are not real code that can be executed. Only when the template is instanciated with a type does the compiler produce the code that can be executed.The AngelScript templates mimics the C++ templates when seen from the scripts, but they are not true C++ templates. Instead the AngelScript templates are implemented as generic dynamic containers.You would register the stringw class as any other class. In fact you can take a look at how the std::string is registered in the ScriptStdString add-on. Regards,AndreasThanks a lot. I will try that and update on any progress I make.   ;  I am trying to register the vector3d<f32> (aka vector3df) class according to the Vector3 example, and it seems to not work when registering methods.  if (   (   scriptEngine->RegisterObjectMethod("vector3df", "vector3df getDistanceFrom(vector3df &other)", asMETHOD(irr::core::vector3df, getDistanceFrom), asCALL_THISCALL)   )<0)This will not register. I'm binding the class as a value type, does that make a difference?   ;  I don't see anything wrong with your code. What is the error that you're getting?Yes, you're correct in registering the vector3df class as a value type.   