C++ : nested STL woes...

Started by
4 comments, last by joanusdmentia 18 years ago
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
Advertisement
What compiler version are you using?
VS C++ .NET 2003
Ive never seen this in 2003. Wierd.

Dave
I've gotten a similar error in VS2005. It happened when I tried to include a locally defined class as a template parameter:

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;

"Voilà! In view, a humble vaudevillian veteran, cast vicariously as both victim and villain by the vicissitudes of Fate. This visage, no mere veneer of vanity, is a vestige of the vox populi, now vacant, vanished. However, this valorous visitation of a bygone vexation stands vivified, and has vowed to vanquish these venal and virulent vermin vanguarding vice and vouchsafing the violently vicious and voracious violation of volition. The only verdict is vengeance; a vendetta held as a votive, not in vain, for the value and veracity of such shall one day vindicate the vigilant and the virtuous. Verily, this vichyssoise of verbiage veers most verbose, so let me simply add that it's my very good honor to meet you and you may call me V.".....V

This topic is closed to new replies.

Advertisement