🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

Insertion operator

Started by
0 comments, last by WitchLord 18 years, 7 months ago
I'm having troubles registering the << operator for one of my classes. I saw an example in the forums here on a way that worked, and it was done by making the operator a global behavior (and also having an assignment operator registered). Is it possible to register the << operator as an object behaviour, or only global? -D // lessbread edit - added title [Edited by - Desdemona on November 21, 2005 1:43:35 AM]
Advertisement
Currently it is only possible to register it as a global operator, which unfortunately makes it difficult to use as insertion operator, as the operands are not the true objects but instead copies of them.

To work around the fact that the objects are copies, you'll probably need to write a container class that holds the pointer to the real object and when copied just copies the pointer so that both the original container and the copy works on the same object.

I'm planning on changing this (if it is possible) to make it easier to do these very common overloads in AngelScript as well. One of potential solutions would be to allow the registration of the operator as an object behaviour.

Regards,
Andreas

AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game

This topic is closed to new replies.

Advertisement