// compile-time sizeof()! Aww yeah.
template<int s> struct Wow { int x; };
Wow<sizeof(MyClass)> unused = 5;
and when you compile the file you get an error like
1>.\file.cpp(32) : error C2440: 'initializing' : cannot convert from 'int' to 'Wow<s>'
1> with
1> [
1> s=1044
1> ]
1> No constructor could take the source type, or constructor overload resolution was ambiguous
and there's the size of your class!
No comments:
Post a Comment