I came across this snippet
template <typename T, size_t N>
char (&ArraySizeHelper(T (&array)[N]))[N];
#define arraysize(array) (sizeof(ArraySizeHelper(array)))
in this article http://software.intel.com/en-us/articles/pvs-studio-vs-chromium/
I've seen other templates to do the same thing, like this one
Use templates to get an array's size and end address
and I understand those, but I've been having difficulty with this one.
Any help would be appreciated.
See Question&Answers more detail:os