Archived

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

emileej

A vector in a vector

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