Problem creating new Vector<> based console types - NOT A BUG
by Manoel Neto · in Torque 3D Professional · 08/22/2010 (2:03 pm) · 3 replies
In 1.1b1 I had a custom console type for Vector<String> (done in the same way the other Type***Vector types are done), which worked without problems. With 1.1b2 it just won't compile:
Oddly enough, if I use a Vector<T> where T is a primitive (bool, S32, F32, etc), it works. Anything else (including const char*) will fail. What is different about the primitives in vectors what make the compile?
1>c:svntrunkenginesourceconsoleenginetypes.h(105) : error C2039: 'SuperType' : is not a member of 'Vector<T>' 1> with 1> [ 1> T=String 1> ] 1> c:svntrunkenginesourceconsoleenginetypes.h(131) : see reference to class template instantiation '_EngineTypeTraits<T>' being compiled 1> with 1> [ 1> T=Vector<String> 1> ] 1> c:svntrunkenginesourceconsoleenginetypes.h(151) : see reference to class template instantiation 'EngineTypeTraits<T>' being compiled 1> with 1> [ 1> T=Vector<String> 1> ] 1> c:svntrunkenginesourceconsoledynamictypes.h(226) : see reference to function template instantiation 'const EngineTypeInfo *TYPE<T>(void)' being compiled 1> with 1> [ 1> T=Vector<String> 1> ] 1> c:svntrunkmy projectssoccersourcesoccercontrolmodule.cpp(11) : see reference to function template instantiation 'const EngineTypeInfo *_MAPTYPE<Vector<T>>(void)' being compiled 1> with 1> [ 1> T=String 1> ] 1>c:svntrunkenginesourceconsoleenginetypes.h(105) : error C2146: syntax error : missing ';' before identifier 'SuperType' 1>c:svntrunkenginesourceconsoleenginetypes.h(105) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int 1>c:svntrunkenginesourceconsoleenginetypes.h(105) : error C2602: '_EngineTypeTraits<T>::SuperType' is not a member of a base class of '_EngineTypeTraits<T>' 1> with 1> [ 1> T=Vector<String> 1> ] 1> c:svntrunkenginesourceconsoleenginetypes.h(105) : see declaration of '_EngineTypeTraits<T>::SuperType' 1> with 1> [ 1> T=Vector<String> 1> ] 1>c:svntrunkenginesourceconsoleenginetypes.h(105) : error C2868: '_EngineTypeTraits<T>::SuperType' : illegal syntax for using-declaration; expected qualified-name 1> with 1> [ 1> T=Vector<String> 1> ]
Oddly enough, if I use a Vector<T> where T is a primitive (bool, S32, F32, etc), it works. Anything else (including const char*) will fail. What is different about the primitives in vectors what make the compile?
About the author
Recent Threads
#2
Yes, the console type system is now tied to the more rigid and expressive engine export type system which you've been running into here. The error you got was because with no other more specific declaration, the type system assumed it was dealing with a class type. Using DECLARE_STRUCT (which should be placed in a header and included by all engineAPI definitions that use it) you specified that the type kind for Vector<String> isn't a class type but a struct type.
BTW, minor thing, the IMPLEMENT_STRUCT there should use StringVector (or something alike) as the export name. Doesn't really matter as far as the console interop is concerned, though.
08/22/2010 (5:33 pm)
Yes, the console type system is now tied to the more rigid and expressive engine export type system which you've been running into here. The error you got was because with no other more specific declaration, the type system assumed it was dealing with a class type. Using DECLARE_STRUCT (which should be placed in a header and included by all engineAPI definitions that use it) you specified that the type kind for Vector<String> isn't a class type but a struct type.
BTW, minor thing, the IMPLEMENT_STRUCT there should use StringVector (or something alike) as the export name. Doesn't really matter as far as the console interop is concerned, though.
#3
08/24/2010 (1:36 pm)
As Rene noted, this is not a bug, but implemented as designed.
Associate Manoel Neto
Default Studio Name
And