How do you initialize (through initializer lists) a multidimensional std::array in C++11?

后端 未结 2 1246
我寻月下人不归
我寻月下人不归 2020-12-16 14:57

I am trying to initialize a 2D std::array trough initializer lists however the compiler tells me that there are too many initializers.

e.g.:

std::ar         


        
2条回答
  •  感情败类
    2020-12-16 15:49

    I would suggest (without even have trying it, so I could be wrong)

    typedef std::array row;
    std::array shape = { row {1,1}, row {1,1} };
    

提交回复
热议问题