Skip to content

Instantly share code, notes, and snippets.

@beakr beakr/arysize.cpp
Created Sep 17, 2014

What would you like to do?
Chromium's amazing C++ macro for sizing (standard C) arrays.
template <typename T, size_t N>
char (&ArraySizeHelper(T (&array)[N]))[N];
#define arysize(array) (sizeof(ArraySizeHelper(array)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.