struct AType {
const byte data[4];
AType(const byte d[]):data{d[0],d[1],d[2],d[3]} {}
...
};
const byte SERIALNR[4] = {0,0,9,0xFF};
AType SNr {SERIALNR};
This works, but I consider it a bit ugly. Is there a syntax with a shorter initializer list? And: How to do it, if that magic 4 were a template parameter?
The initialization of SERIALNR is just to make the sample complete, my goal is to implement something nice, allowing
AType SNr {SERIALNR}; or similar
And yes, that thing should be able to be constructed as const, if possible
std::arrayinsteadAType SNr {0,0,9,0xFF};?