C++ member initialisation of an array element

How to do member initialisation of an array element ?

1
2
3
4
5
6
7
8
9
10
11


class A {
  public:
  A(const char*){}
}

class B {
  A a[32];
  B(const char* name):a?? {
}.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
class A
{
public:
    A() = default;
    A(const char*) {}
};

class B
{
    A a[32];
    B(const char* name) :
        a {{"First"}, {"sixteen"}, {"elements"}, {"are"}, {"initialized"}, {"using"},
           {"const char*"}, {"constructor"}, {"the"}, {"rest"}, {"are"}, {"initialized"},
           {"by"}, {"default"}, {"constructor"}, {""}}
    {}
};

Topic archived. No new replies allowed.