Sign in to follow this  

Default parameters within namespace

Recommended Posts

iraxef    451

I have some binding code along these lines:


engine->RegisterObjectType("MyType", sizeof(MyType), asOBJ_VALUE | as OBJ_POD | ...);

engine->RegisterObjectMethod("SomeObject", "MyType AFunction(MyType param = MyType()) const", ...);

If in script you call AFunction() and don't provide the default parameter, that script will fail to compile with:

Identifier 'MyType' is not a data type
A cast operator has one argument
Identifier 'MyType' is not a data type
The type of the default argument expression doesn't match the function parameter type

Is it possible to make the compiler look at the current 'default namespace' when resolving this default parameter?


Thank you!

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this