如何创建4维数组 [英] How to create 4 dimensional array

查看:98
本文介绍了如何创建4维数组的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我想创建4维数组,前三个维度是固定大小,最终索引是0到N数。

例如, double array [500] [25] [10] [< NOT FIXED>] ..所以我不能静态创建,因为索引大小更多。我也尝试了4个尺寸的矢量,但它给出了2个问题。

(i)我存储的第4个尺寸大于矢量[0] [0] [0] .max_size()

(ii)在向量中存储和检索更多时间


所以请告诉我,如果任何其他解决方案来存储3个索引的大数组是固定的最后一个不是固定的?

寻找任何人的答案..


谢谢。

Hi,
I want to create 4 dimensional array, in that first three dimenstional are fixed size and the final index will be on 0 to N-numbers.
For eg, double array[500][25][10][<NOT FIXED>].. So I cant create statically, because the index size are more. Also I have tried 4 dimenstional vector, but its giving 2 problem.
(i) I am storing 4th dimenstion size is more than vector[0][0][0].max_size()
(ii) Storing and Retrieving its more time in vector

So Please let me know, if any other solution to store large array which is 3 index is FIXED and final one is not FIXED?
Looking for answer from anyone..

Thanks.

推荐答案

阅读本文:< a href =http://bytes.com/topic/c/insights/772412-arrays-revealedtarget =_ blank> http://bytes.com/topic/c/insights/77...rrays-透露


通过在堆上分配自己的数组,可以轻松实现所描述的内容。链接文章中有一些例子。
Read this: http://bytes.com/topic/c/insights/77...rrays-revealed

What you describe is easily achieved by allocating your own array on the heap. There are examples in the linked article.


您好,

感谢您的回复。

您可以通过一些示例或链接来创建堆上自己的数组?
Hi,
Thanks for your reply.
Can you some example or link to create the own array on the heap?


这个例子在我的文章#2中链接的文章中。
The example is in the article linked to in my post #2.


这篇关于如何创建4维数组的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆