简体   繁体   English

对象向量的初始化

[英]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; 正确的行是:set vide; vector< vector< vector< set > > > tableau_des_ranges( 10, vector > >( 10, vector > ( 10, 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 非常感谢你,很抱歉这个问题

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 . 类型声明的内部向量类型为set<CardSet> ,而用于初始化向量的临时变量将其类型set<CardSet> CardSet One of these is wrong. 其中之一是错误的。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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