I'm trying to do yet another reflection library for C++, one feature that I want is to check at compile time that user enumerate all struct fields and all of them in right order(this part was easy). I tried to just sum member sizes and compare to size of whole struct, but this doesn't work cause padding. Any way to do this? Like get sizeof member + padding in struct.
struct Test {
bool a;
float b;
};
static_assert(sizeof(Test) == sizeof(Test::a) + sizeof(Test::b));