Hallo,
is there some easy way in C++ to tell (in compile-time) if a class/struct has no data members?
E.g. struct T{};
My first thought was to compare sizeof(T)==0
, but this always seems to be at least 1.
The obvious answer would be to just look at the code, but I would like to switch on this.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…