好的,我知道在C++中,一个二维数组可以这样初始化:
int theArray[5][3] = {
{1,2,3},
{4,5,6},
{7,8,9},
{10,11,12},
{13,14,15}
};
现在,如果我想使用预先存在的数组作为theArray
的元素呢?
例如:
// A, B, C, D,... have already been declared as :
// `const U64 A[] = { 1,2,3,4 };` etc...
const U64 multiDimArray[12][64] = {
A, B, C, D, E, F,
G, H, I, J, K, L
};
这个代码会抛出一个错误:
这个代码会抛出一个错误:
cannot initialize an array element of type 'const U64'
(aka 'const unsigned long long') with an lvalue of type 'const U64 [64]'
我理解您的意思,但希望您也能理解我的。
有没有一种方法可以绕过去,让我轻松地实现同样的事情?(欢迎任何建议 - 也许使用Boost?)