summaryrefslogtreecommitdiff
path: root/src/array_fun.h
diff options
context:
space:
mode:
authorTatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>2014-08-29 23:37:31 +0900
committerTatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>2014-08-29 23:37:31 +0900
commitae631513f33da0bba2a2d9a9b0b9207358568cc6 (patch)
tree8164feba6fd9ee9a09aff9d3cf5500b983922bb3 /src/array_fun.h
parentb8b291187d45ce985f218688edbd1cffc479c6d5 (diff)
Replace A2_ARRAY_LEN with constexpr arraySize
Diffstat (limited to 'src/array_fun.h')
-rw-r--r--src/array_fun.h13
1 files changed, 4 insertions, 9 deletions
diff --git a/src/array_fun.h b/src/array_fun.h
index c59ebc17..80a56046 100644
--- a/src/array_fun.h
+++ b/src/array_fun.h
@@ -42,16 +42,11 @@
namespace aria2 {
-// calculate length of array
template<typename T, size_t N>
-char (&char_array_ref_fun(T (&)[N]))[N];
-
-// For 0 length array
-template<typename T>
-char (&char_array_ref_fun(T (&)[0u]))[0u];
-
-// To calculate size of array at compile time, we use macro here.
-#define A2_ARRAY_LEN(X) sizeof(char_array_ref_fun(X))
+constexpr size_t arraySize(T (&)[N])
+{
+ return N;
+}
template<typename T, size_t N>
class array_wrapper {