Compiler hang when initializing large std::arrays

前端 未结 3 1921
清歌不尽
清歌不尽 2021-01-12 16:21

I need to initialize a very large multidimensional std::array of data:

class Thing;

class World
{
public:
    World() : space{nullptr} {};
             


        
3条回答
  •  臣服心动
    2021-01-12 16:38

    Ok, i can't explain the nuance of why g++ is puking on this, but until you work that out, consider this for your member declaration:

    std::vector,size>,size>> space;
    

    and in the constructor initializer list:

    World() : space{size}
    

    That should at least get you compiling and move all this to the heap. Note: this better be a 64bit process. I'm going to have to hunt to find out why g++ is doing what I suspect it is doing.

提交回复
热议问题