3 C++的3维矢量
我想存储一个对象向量的节点和集合子集。 因此,我想实现一个3 d向量,其中第一个维度的大小#nodes = n,第二维为2^| set | = m。最后一个维度不应该具有固定的大小,因为我想在程序中附加新对象。
vector< vector < vector<Object>>> Vector3d( n , ( m, ( ( ???)))
我应该写什么而不是写???
我试图使用向量内部的数组,但是我没有这样成功。
先感谢您
i want to store a vector of objects for a node and subset of set.
so I want to implement a 3 d vector where the first dimension has size #nodes = n and the second dimension has size 2^|set| = m. the last dimension shouldn't have fixed size, because I want to append new objects in my program.
vector< vector < vector<Object>>> Vector3d( n , ( m, ( ( ???)))
what should I write instead of ???
i have tried to use arrays inside of a vector, but I didn't succeed that way.
thank you in advance
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
初始化的方法是
这将有效,因为它将初始化第一个维度的大小为n,其中包含
n
novector&lt; vector&vector&lt; object&gt;(m)
哪个是默认值。现在,第二维的大小定义为M,没有初始值,因此您可以将任何向量附加到第二维空间。ie
i和j是前两个维度的索引
The method of initialisation is
This will work, as it will initialize the first dimension's size as n, which would contain
n
no ofvector<vector<Object>(m)
which is the default value. Now the size of the second dimension is defined as m, which has no initial value, hence you can append any vector to the second dimension space.i.e.
where i and j are the indexes of the first 2 dimensions