Jump to content
  • Advertisement
Sign in to follow this  

Class Binding Utility

This topic is 4653 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

If you find yourself binding a lot of classes that all have the basic operators, you might find this little template usefull. Instead of writing lots of wrapper functions, just grab them out of the template! Instead of
. The wrapper is generated for you. Use with the calling convention asCALL_CDECL_OBJLAST.

template <typename T>
class CDA
	static void Construct(T* ptr) { new (ptr) T(); }
	static void CopyConstruct(const T& rhs, T* ptr) { new (ptr) T(rhs); }
	static void Destroy(T* ptr) { ptr->~T(); }
	static T& Assign(const T& rhs, T* ptr) { return (*ptr) = rhs; }


I plan on expanding this to cover wrappers for all binary operators (And probably the unary operators too, just for consistency) before releasing it as part of my AutoBind utility I am working on. By then, it will be changed so that the template will still compile if your class does not support a certain operator. Just don't try and bind that operator. [PS - Witchlord; does 2.x support the pre/post increment/decrement operators?]

Share this post

Link to post
Share on other sites
No, AngelScript currently doesn't support overloading the increment and decrement operators, it's on my to-do list though.

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!