简体   繁体   中英

Set inside a vector inside a vector

I am trying to implement a matrix box and for that to work I have to use a set inside a vector inside another vector.

  vector<vector<set<int> > > matrix;

however I have to set the size of my vectors in my constructor so I tried this

matrix(3,vector<set<int> >(4));

however It gave me an error type 'vector<vector<set<int> > >' does not provide a call operator . Can someone explain why is this happening?

The line

matrix(3,vector<set<int> >(4));

doesn't call the constructor, but tries to call an overloaded call operator ( operator()() ) of std::vector , which doesn't provide one.

To call the constructor write

vector<vector<set<int> > > matrix(3,vector<set<int> >(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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM