Edited again because it originally wasn\'t clear that I\'m trying to initialize the arrays at compile time, not at run time...
I\'ve got the following reduced
struct TestStruct {
int length;
const int *values;
};
static const uint8_t TEST_STRUCT_VAL_1[] = {0, 1, 2};
const TestStruct t1 = {3, TEST_STRUCT_VAL_1};
static const uint8_t TEST_STRUCT_VAL_2[] = {0, 1, 2, 3};
const TestStruct t2 = {4, TEST_STRUCT_VAL_2};`
In my case, stm32 programming with gcc/g++, the value array is only raw data storage, so it is static const, and would be stored in flash. I use this way to store font patterns for lcd display.
using template is typing saving, but not size saving.