I want to initialize the Foo class
class Foo {
public:
struct MyStruct {
uint8 i;
char c;
};
Foo(MyStruct args...){
};
};
But I'm getting a error
error: invalid use of brace-enclosed initializer list
auto test = Foo(
{1, 'a'},
{2, 'b'}
);
If I do this with variables, there is no error
Foo::MyStruct a1 = {1, 'a'};
Foo::MyStruct b2 = {2, 'b'};
auto test = Foo(a1, b2);
But I'm not comfortable with that, I'd like to make the code a compact
Aucun commentaire:
Enregistrer un commentaire