对象矢量的初始化

时间:2021-06-17 17:00:44

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.

Ps:我没有找到答案,因为我没有关键字:所以,如果你知道我应该搜索什么,请随时告诉我。

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

正确的行是:设置视频; vector >> 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

非常感谢,对不起这个问题

1 个解决方案

#1


2  

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.

类型声明在内部向量中的类型为set ,而用于初始化向量的临时对象将其设置为CardSet。其中一个是错误的。

#1


2  

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.

类型声明在内部向量中的类型为set ,而用于初始化向量的临时对象将其设置为CardSet。其中一个是错误的。