🎉 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!

noob question: implicit conversions between class instances

Started by
1 comment, last by penguinpusher 17 years, 1 month ago
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
Advertisement
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

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

Hi witchlord :) Actually that's exactly what I need, Bundles are light weight, as are Arrays and Values. In general rapidmind classes don't own their data, they can't, instead they keep host and GPU ram synchronised.

Thanks.
Lorien Dunn

This topic is closed to new replies.

Advertisement