如何在C ++中使用大小初始化3维向量 [英] How to initialize 3 dimension vector with the size in C++
本文介绍了如何在C ++中使用大小初始化3维向量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
例如,如果我们初始化 vector< vector< vector< double>>>。 f
,未指定每个方向的尺寸。因此,我想知道,我们应该插入什么命令以使 f
的大小为 [3] [4] [5]
。
For example, if we initialize vector<vector<vector<double>>> f
, the dimension in each direction is not specified. So, I am wondering, what command should we insert to make f
have size of [3][4][5]
. Do we use new or something else?
感谢您的帮助!
推荐答案
vector<vector<vector<double>>> f(3, vector<vector<double>>(4, vector<double>(5)));
这篇关于如何在C ++中使用大小初始化3维向量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文