summaryrefslogtreecommitdiff
path: root/src/a2functional.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/a2functional.h')
-rw-r--r--src/a2functional.h17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/a2functional.h b/src/a2functional.h
index 963399be..8382b572 100644
--- a/src/a2functional.h
+++ b/src/a2functional.h
@@ -107,3 +107,20 @@ adopt2nd(const BinaryOp& binaryOp, const UnaryOp& unaryOp)
{
return adopt2nd_t<BinaryOp, UnaryOp>(binaryOp, unaryOp);
};
+
+template<typename T, std::size_t N>
+char (&char_array_ref(T (&)[N]))[N];
+
+template<typename T, std::size_t N>
+std::size_t
+arrayLength(T (&a)[N])
+{
+ return sizeof(char_array_ref(a));
+}
+
+template<typename T>
+std::size_t
+arrayLength(T (&a)[0u])
+{
+ return 0;
+}