While migrating to C++ I require a certain function that seems to have been deprecated.
sorry, unimplemented: non-trivial designated initializers not supported
What is the correct way to implement the following data storage system in C++ for memory constraint systems?
typedef union union_t {
float f;
int i;
} arg;
typedef struct type_t {
int a;
arg b;
int d;
} element;
const element list[] = {
{
.a = 1,
.b = { .f = 3.141519f },
.d = 6
},
{
.a = 3,
.b = { .i = 1 },
}
};
Often the use of std:map
or std:vector
is suggested. Which is suitable, however list
is immutable and must be able to compile and link to a specific block of flash. Both seem unfit for that purpose.
The highest I can go is ARM Compiler 6, which is C++14.