在迁移到 C++ 时,我需要某个似乎已被弃用的函数。
sorry, unimplemented: non-trivial designated initializers not supported
在 C++ 中为内存约束系统实现以下数据存储系统的正确方法是什么?
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 },
}
};
通常建议使用std:map
or std:vector
。这是合适的,但list
它是不可变的,并且必须能够编译和链接到特定的闪存块。两者似乎都不适合这个目的。
我能达到的最高版本是 ARM Compiler 6,它是 C++14。