user2964288
user2964288

Reputation: 83

Initialisation of a vector of object

How can I initialise a vector with objects?

I have tried:

set<CardSet> empty;
vector< vector< vector< set<CardSet> > > > range_table( 10, vector<vector<CardSet> >( 10, vector<CardSet> ( 10, empty) ) );

Ps: I didn't found the answer maybe because I do not have the keywords: So if you know what I should search feel free to tell me.

the correct lines are: set vide; vector< vector< vector< set > > > tableau_des_ranges( 10, vector > >( 10, vector > ( 10, vide) ) );

I do not believe that someone else will use it maybe to see a triple vector ^^

thank you very much and sorry for this question

Upvotes: 0

Views: 52

Answers (1)

Mike Seymour
Mike Seymour

Reputation: 254631

The type declaration has the type in the inner vector as set<CardSet>, while the temporaries used to initialise the vectors have it as just CardSet. One of these is wrong.

Upvotes: 2

Related Questions