src/macros.h

changeset 1062
4119185b56ca
parent 1059
7800dbb00632
child 1072
9ce9496427f2
equal deleted inserted replaced
1061:273333700685 1062:4119185b56ca
20 #include <type_traits> 20 #include <type_traits>
21 21
22 #ifndef __GNUC__ 22 #ifndef __GNUC__
23 # define __attribute__(X) 23 # define __attribute__(X)
24 #endif 24 #endif
25
26 template <typename T, size_t N>
27 char (&countofHelper (T(&)[N]))[N];
28 #define countof(x) ((int) sizeof (countofHelper(x)))
29 25
30 #define DEFINE_CLASS(SELF, SUPER) \ 26 #define DEFINE_CLASS(SELF, SUPER) \
31 public: \ 27 public: \
32 using Self = SELF; \ 28 using Self = SELF; \
33 using Super = SUPER; 29 using Super = SUPER;

mercurial