Advertisement

Issue in registering template specialization?

Started by October 30, 2014 02:43 PM
16 comments, last by WitchLord 10 years ago

Problem solved in revision 2034.

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

I experimentally skipped the registering of vector_iterator<int8> if it has been registered, then I met a new problem that the asBEHAVE_CONSTRUCT of vector_iterator<int8> cannot be registered because "Can't support template subtypes by value, since each type is treated differently in the ABI" in asCScriptEngine::RegisterBehaviourToObjectType():


// Can't support template subtypes by value, since each type is treated differently in the ABI
if( !func.returnType.IsObjectHandle() && !func.returnType.IsReference() )
{
	return ConfigError( asNOT_SUPPORTED, "RegisterObjectMethod", objectType-&gt;name.AddressOf(), decl );
}

while the behaviour function decl is void f(vector<int8>@).
As constructor of value types all take "void" as return type,does this mean all template class should be reference type?

Advertisement

Just updated to svn 2036, still getting the same error in the same place.

asNOT_SUPPORTED

and

"Cannot register template specialization. The template type instance 'vector_iterator<int8>' has already been g

enerated."


As constructor of value types all take "void" as return type,does this mean all template class should be reference type?

No, template classes can be value types too. But in your situation you're trying to register a constructor for a generated template instance. I'll need to add a validation for this too just to return a proper error message.


Just updated to svn 2036, still getting the same error in the same place.

That's odd. Guess I'll have to do a little debugging with your code 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

Problem fixed in revision 2038. For real this time. I hope :)

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

Updated AS to svn 2038

AATC code not changed

...and the error is gone! yay

The AATC test application worked without changes.

My game project worked after removing all my deprecated asBEHAVE_IMPLICIT_VALUE_CAST casts.

Are value types now cast automagically with asIScriptEngine::CastObject or do we need to register them with some new syntax?

Advertisement
Great,all codes work now,Thanks!


The AATC test application worked without changes.
My game project worked after removing all my deprecated asBEHAVE_IMPLICIT_VALUE_CAST casts.

Are value types now cast automagically with asIScriptEngine::CastObject or do we need to register them with some new syntax?

Instead of registering asBEHAVE_IMPLICIT_VALUE_CAST you should now register a method with the name opImplConv. (opConv for explicit conversions).

CastObject is only meant for reference casts. Perhaps I should rename it to RefCastObject just to avoid misunderstandings.

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