C++ : nested STL woes...
Hello all,
Now in the past, I know I have been able to write code like this:
vector< vector< MyObj > > m_v2DObjs;
It works fine, and does what I want it to. However, today I tried writing this:
map< int, vector< MyObj > > m_mvObjs;
And I get an "INTERNAL COMPILER ERROR". No idea what it means, it tells me to go on tech support. Is this kind of template nesting not supported in the language?
Any insight would be greatly appreciated.
Thanks,
jujumbura
I've gotten a similar error in VS2005. It happened when I tried to include a locally defined class as a template parameter:
I get the feeling this isn't legal C++, but regardless, the error went away when I moved the class definition to global scope.
John Edwards
void func( ){ class Foo { /**/ }; std::vector< Foo > vec; // INTERNAL COMPILER ERROR!}
I get the feeling this isn't legal C++, but regardless, the error went away when I moved the class definition to global scope.
John Edwards
Quote:And I get an "INTERNAL COMPILER ERROR". No idea what it means, it tells me to go on tech support. Is this kind of template nesting not supported in the language?
It means you've managed to find a bug in the compiler [smile] What you've shown is perfectly valid C++, when you hit errors like this the only thing you can do is try and rearrange your code to get around it or find a different way of doing whatever it is you're doing. Try things like the below, change the order of declarations, etc.
typedef std::vector<MyObj> MyObjVector;typedef std::map<int,MyObjVector> MyObjMap;MyObjMap m_mvObjs;
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement