I'd like to be able to initialize an object with the following syntax in C++14:
const auto data1 = DataOne{1, 2, 3};
const auto data2 = DataTwo{1, 2, 3, 4, 5};
const auto data3 = DataThree{1, 2, 3, 4, 5, 6, 7};
Which gives me the following error message:
error msg `error: no matching function for call to ‘DataThree::DataThree(<brace-enclosed initializer list>)’`
With the types defined as:
struct DataOne
{
int a;
int b;
int c;
};
struct DataTwo : DataOne
{
int d;
int e;
};
struct DataThree : DataTwo
{
int f;
int g;
};
I dont want to use the struct in struct method because then I will need to call params through double or triple dots which I dont want to use because all the members are equal important and it will look bad to read.