Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

emileej

A vector in a vector

This topic is 5322 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

I am creating a struct to hold some data I get from a database call - my plan is to store the value table in a double vector, but my compiler disagrees. Here is my code:
//...

struct result{					//Line 36

	vector<string> cols;			//Line 37

	vector<vector<string>> values;	//Line 38

};							//Line 39

//...

table MyFunc(/*...*/);				//Line 68

//...

And here is my compiler (MSVC++) weeping:
C:\...server.cpp(38) : error C2146: syntax error : missing '','' before identifier ''values''
C:\...server.cpp(38) : error C2065: ''values'' : undeclared identifier
C:\...server.cpp(38) : error C2143: syntax error : missing ''>'' before '';''
C:\...server.cpp(38) : error C2208: ''class std::vector'' : no members defined using this type
C:\...server.cpp(68) : error C2146: syntax error : missing '';'' before identifier ''SQL''
C:\...server.cpp(68) : error C2501: ''tabel'' : missing storage-class or type specifiers
C:\...server.cpp(68) : fatal error C1004: unexpected end of file found
 
Double vectors... How is it done or perhaps it isnt? "Stop trying to hit me and hit me!"

Share this post


Link to post
Share on other sites
Advertisement
you need a space in there to stop the compiler thinking its the >> operator


std::vector<std::vector<int> > something(10, std::vector<int>(10)); // a 10x10 array

Share this post


Link to post
Share on other sites
This is one of the reasons I like the Borland compiler:
Warning W8049 tmp.cpp 38: Use ''> >'' for nested templates instead of ''>>''


Enigma

Share this post


Link to post
Share on other sites

  • 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!