Skip to content

Instantly share code, notes, and snippets.

@gpakosz
Created January 5, 2017 21:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gpakosz/fc63e3f451e07a3f9eee19fbca9814c7 to your computer and use it in GitHub Desktop.
Save gpakosz/fc63e3f451e07a3f9eee19fbca9814c7 to your computer and use it in GitHub Desktop.
C++98 array_length
#include <cstddef>
#define array_length(a) sizeof(impl::array_length_requires_array_argument(a))
namespace impl {
template<typename T, size_t N>
char (&array_length_requires_array_argument(T (&)[N]))[N];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment