I need to initialize a very large multidimensional std::array
of data:
class Thing;
class World
{
public:
World() : space{nullptr} {};
vector>>> space;
and when initializing it:
for (int i = 0; i < 1000; i++)
{
vector>> sp1;
for (int j = 0; j < 1000; j++)
{
vector> sp2;
for (int k = 0; k < 1000; k++)
sp2.push_back(make_unique("params", "to", "construct", "thing"));
sp1.push_back(move(sp2));
}
space.push_back(move(sp1));
}
It is similar to your approach, but it constructs the vectors in the heap instead of stack.