Implicit cast from built-in type to custom type,
Members - Reputation: 101
Posted 20 November 2012 - 07:24 PM
How am I supposed to represent this with the RegisterObjectBehaviour function? The type for the obj parameter appears to be just custom types so you can't add functionality to built-in types. The type I am wanting to create is a value, plain old data type, so I don't want to use a class for the conversions.
Any help is greatly appreciated.
Moderators - Reputation: 4337
Posted 21 November 2012 - 01:44 PM
When it is supported though it will be done by registering a constructor/factory for the custom type that takes the built-in type. You can already register that constructor, but you'll have to call it explicitly to do the conversion.
Most situations where you'd use the implicit cast you can get working anyway by implementing overloaded functions to take the built-in type instead of the custom type. This usually gives better performance, even though it will require a bit more work to implement the overloads.
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game