开发者

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜