suppose we have the following class in C++11 or later:
class MyClass {
private:
const std::array<SomeType, 100> myArray;
public:
explicit MyClass(std::array<SomeOtherType, 100> initArray);
};
Assuming that class SomeType has a constructor that takes a single SomeOtherType as an argument, is it possible to initialize the const member array using list-initialization in the constructor? What is the syntax for doing so?
Clearly, just directly initializing it like this doesn't work:
MyClass::MyClass(std::array<SomeOtherType, 100> initArray) :
myArray{initArray} {}
Thanks!