xmscore
1.0
|
Utilities for c-style arrays. More...
Go to the source code of this file.
Macros | |
#define | XM_COUNTOF(array) (sizeof(::xms::caArraySizeHelper(array))) |
Returns the number of elements of a C/C++ array. More... | |
Functions | |
template<typename T , size_t N> | |
char(& | xms::caArraySizeHelper (T(&array)[N]))[N] |
Helper to get the number of elements of a C/C++ array. More... | |
Utilities for c-style arrays.
Definition in file carray.h.
#define XM_COUNTOF | ( | array | ) | (sizeof(::xms::caArraySizeHelper(array))) |
char(& xms::caArraySizeHelper | ( | T(&) | array[N] | ) | )[N] |
Helper to get the number of elements of a C/C++ array.
array | Array of data |
Found this here: http://blogs.msdn.com/the1/pages/210011.aspx. Note that "it doesn't work with types defined inside a function because _ArraySizeHelper expects a type that is accessible in the global scope." In the future could change to a C++11 version from http://www.g-truc.net/post-0708.html: