I want to find the byte offset of a struct member at compile-time. For example:
struct vertex_t
{
vec3_t position;
vec3_t normal;
vec2_t texcoord;
}
I would want to know that the byte offset to normal
is (in this case it should be 12
.)
I know that I could use offsetof
, but that is a run-time function and I'd prefer not to use it.
Is what I'm trying to accomplish even possible?
EDIT: offsetof
is compile-time, my bad!
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…