summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas Schodet2012-12-13 19:43:48 +0100
committerNicolas Schodet2012-12-18 22:33:08 +0100
commitee758032627c83809e83e453d310d874cfddab14 (patch)
treee473add48b16f1399f857681982e68d26a53f004
parent1f410aa3d245ceef590bdcf981e67b39e794b0a9 (diff)
digital/ucoolib/ucoolib: add lengthof, to measure an array
-rw-r--r--digital/ucoolib/ucoolib/common.hh3
1 files changed, 3 insertions, 0 deletions
diff --git a/digital/ucoolib/ucoolib/common.hh b/digital/ucoolib/ucoolib/common.hh
index 5be6227f..1f6d75ae 100644
--- a/digital/ucoolib/ucoolib/common.hh
+++ b/digital/ucoolib/ucoolib/common.hh
@@ -72,4 +72,7 @@ assert_perror (bool condition)
} // namespace ucoo
+/// Get array length at compile time, must be a macro until c++11.
+#define lengthof(array) (sizeof (array) / sizeof((array)[0]))
+
#endif // ucoolib_common_h