
25 Jun
2006
25 Jun
'06
11:28 p.m.
On Sun, 25 Jun 2006 17:43:26 -0400, David Abrahams <dave@boost-consulting.com> wrote:
That somersault is easy enough (although I've forgotten what it was exactly, there's an easy workaround).
Indeed I found it at the first try :) template <std::size_t n> struct counter { enum { n = n }; // yep :) template <typename t> static char(&count(t(*)[n]))[n]; }; #define COUNT_OF(x) \ (sizeof counter<(sizeof x / sizeof x[0])>::count(&x)) PS: note the enum! --Gennaro.