I am porting some C code to C++ and I am trying to initialize a struct with some values. I want the struct to be stored in flash (const) and not in RAM, and its values are typedef'd elements.
Originally, I had it like this:
typedef struct
{
typeA_t elementA;
typeB_t elementB;
uint8_t elementC;
} structTypeA_t;
And to instantiate them in flash, I simply did the following:
const structTypeA_t sA = {
.elementA = ONE,
.elementB = TWO,
.elementC = 3
};
I know that this type of initializing is not allowed in C++. How can I achieve it in C++?