Jump to content
  • Advertisement
Sign in to follow this  
jujumbura

C++ : nested STL woes...

This topic is 4563 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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

Share this post


Link to post
Share on other sites
Advertisement
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

Share this post


Link to post
Share on other sites
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;


Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!