Multidimensional std::array
C++StlC++ Problem Overview
In C++, how do I create a multidimensional std::array
? I've tried this:
std::array<std::array<int, 3>, 3> arr = {{5, 8, 2}, {8, 3, 1}, {5, 3, 9}};
But it doesn't work. What am I doing wrong and how do I fix this?
C++ Solutions
Solution 1 - C++
You need extra brackets, until c++14 proposal kicks in.
std::array<std::array<int, 3>, 3> arr = {{{5, 8, 2}, {8, 3, 1}, {5, 3, 9}}};