I’m looking for a method for initializing a complex struct which contains vector in a single row.
For example if I have this structure:
struct A{
double x;
double y;
};
struct B{
double z;
double W;
};
struct C{
A a;
B b;
};
I can initialize C in this way: C c = {{0.0,0.1},{1.0,1.1}};
But what If I have to initialize a struct like this?
struct A{
double x;
double y;
};
struct B{
vector<double> values;
};
struct C{
A a;
B b;
};
I have to do it in a single row because I want to allow the users of my application to specify in a single field all the initial values. And of course, I would prefer a standard way to do it and not a custom one.
Thanks!
You can initialise
Cin a very similar way in C++ to in C: