Initialize a constant sized array in an initializer list

前端 未结 3 609
心在旅途
心在旅途 2021-02-05 05:00

I\'ve got a situation which can be summarized in the following:

class Test
{

    Test();

    int MySet[10];

};

is it possible to initialize

3条回答
  •  别那么骄傲
    2021-02-05 05:17

    Unfortunately, in C++03, you cannot initialize arrays in initializer lists. You can in C++11 though if your compiler is newer :)

    see: How do I initialize a member array with an initializer_list?

提交回复
热议问题