Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/cplusplus/156.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C++ c+中的数组+;有很多错误_C++_C++11 - Fatal编程技术网

C++ c+中的数组+;有很多错误

C++ c+中的数组+;有很多错误,c++,c++11,C++,C++11,因此,我有以下几行代码,其中有许多错误,但我似乎无法找到如何修复它。显示的错误表示初始值设定项太多,必须使用括号内的初始值设定项初始化数组。有人能帮忙吗 const std::array<std::array<int, 3>, 8> m_rows = {{ {0,3,6}, {1,4,7}, {2,5,8}, {0,1,2}, {3,4,5}, {6,7,8},

因此,我有以下几行代码,其中有许多错误,但我似乎无法找到如何修复它。显示的错误表示初始值设定项太多,必须使用括号内的初始值设定项初始化数组。有人能帮忙吗

const std::array<std::array<int, 3>, 8> m_rows =
    {{
        {0,3,6},
        {1,4,7},
        {2,5,8},
        {0,1,2},
        {3,4,5},
        {6,7,8},
        {0,4,8},
        {2,4,6}
    }};
const std::数组m_行=
{{
{0,3,6},
{1,4,7},
{2,5,8},
{0,1,2},
{3,4,5},
{6,7,8},
{0,4,8},
{2,4,6}
}};

您可能需要额外的
{}

const std::array<std::array<int, 3>, 8> m_rows =
{{
    {{0,3,6}},
    {{1,4,7}},
    {{2,5,8}},
    {{0,1,2}},
    {{3,4,5}},
    {{6,7,8}},
    {{0,4,8}},
    {{2,4,6}}
}};
const std::数组m_行=
{{
{{0,3,6}},
{{1,4,7}},
{{2,5,8}},
{{0,1,2}},
{{3,4,5}},
{{6,7,8}},
{{0,4,8}},
{{2,4,6}}
}};

clang和gcc都可以毫无问题地编译此文件,请发布准确的错误消息。复制粘贴只需点击一下:)就会发出叮当声的警告。@Jarod42哦,好的。所以自从6号巨响之后,他们删除了警告