vector of vector
I have the following code开发者_StackOverflow fragment
#include <iostream>
#include <ostream>
#include <vector>
using namespace std;
int main() {
vector<vector<int>>v;
return 0;
}
v.push_back(11)
does not work
what is correct?
#include <iostream>
#include <ostream>
#include <vector>
using namespace std;
int main() {
vector<vector<int> >v;
vector<int> a;
a.push_back(11);
v.push_back(a);
return 0;
}
I think this should work right :)
vector<vector<int>>v;
needs to be
vector<vector<int> >v;
The consecutive >>
acts as the actual >>
operator.
精彩评论