【发布时间】:2016-12-06 16:52:07
【问题描述】:
我正在尝试做这样的事情:
int x=128, y=256;
std::vector<std::array<float,x*y>> codes;
显然这是错误的,而这是正确的:
std::vector<std::array<float,128*256>> codes;
第一个问题的一个解决方案可能是使用如下宏:
#define x 128
#define y 256
...
std::vector<std::array<float,x*y>> codes;
但我想知道在运行时是否有另一种解决方案,而不是在编译时。 注意不必使用std::array,我需要std::vector 的x*y 元素的数组(或其他)。
【问题讨论】: