Advertisement

Need help with latest (SVN) version ref casts

Started by January 08, 2015 12:35 PM
1 comment, last by WitchLord 10 years, 1 month ago

I'm currently trying to integrate the latest version of the library into our codebase, and i've run into a problem.

Our code uses asBEHAVE_REF_CAST and asBEHAVE_IMPLICIT_REF_CAST to register a class hierarchy.

These behaviors have been deprecated, so i'm rewriting the code to use the new opCast and opImpCast operators instead.

The problem is that, unlike the behaviors, the operator doesn't have a compile time guarantee that the destination type is a specific type.

Is there any way to replicate the behavior of the original cast operators?

Preferably without building a table that stores the hierarchy of application registered types.

After looking at some of the compiler's code i'm thinking i simply misunderstood the functionality of this operator.

I assume i have to register a cast operator like this to emulate the original behavior:


BaseType@ opImplCast()
SubType@ opCast()

I was under the impression that only void opCast(?& out) was supported.

Advertisement

opCast and opImplCast is a direct replacement of the previous asBEHAVE_REF_CAST and asBEHAVE_IMPLICIT_REF_CAST.

The only difference from the application side is that you'll use RegisterObjectMethod instead of RegisterObjectBehaviour to register them.

On the script side the change makes it possible to implement the ref casts in script classes too.

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