noob question: implicit conversions between class instances
Are they possible?
I'm doing a special purpose wrap of rapidmind http://rapidmind.net for scriptable realtime audio processing on the GPU, rapidmind has a bundle type, which holds a collection of arrays and values. It's not a template. Rapidmind has implicit conversions from Arrays and Values to Bundles, basically I'd like to have something like this:
Program::bind(Bundle) and be able to pass an Array.
Lorien Dunn
The implicit casting functionality between classes is not fully implemented yet so it'll probably not work quite as smoothly as you'd like.
You may be able to register a constructor for Bundle that is able to initialize the Bundle class from an Array. This in turn will allow the AngelScript compiler to implicitly convert the Array to a Bundle when a Bundle type is requested. It will however only work if the Bundle type is expected 'by value', i.e. not as a reference (∈, &out, or &inout).
I'll be implementing casting behaviours soon enough, which will allow you to register conversion functions that will work in a similar way, though perhaps a bit more flexible.
Regards,
Andreas
You may be able to register a constructor for Bundle that is able to initialize the Bundle class from an Array. This in turn will allow the AngelScript compiler to implicitly convert the Array to a Bundle when a Bundle type is requested. It will however only work if the Bundle type is expected 'by value', i.e. not as a reference (∈, &out, or &inout).
I'll be implementing casting behaviours soon enough, which will allow you to register conversion functions that will work in a similar way, though perhaps a bit more flexible.
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
Popular Topics
Advertisement