Advertisement

noob question: implicit conversions between class instances

Started by May 28, 2007 07:25 AM
1 comment, last by penguinpusher 17 years, 6 months 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
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

Advertisement
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