For a vector of vectors, I would do this:
vector<vector<int> > A(10, vector<int>(10));
So I tried this for a vector of sets:
vector < set <object*> > mySet(4, set<object*>);
..but it won't compile. Any advice?
You are almost right: even though you do not need to specify the size, you still need an empty pair of parentheses:
vector<set<object*>> vsi(4, set<object*>());
// ^^
Moreover, since you are using the default constructor, you could simply omit the second argument, like this:
vector<set<object*>> vsi(4);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.