From 538a8fcfe7d56e2d3bea25599d015df94ab9e7e6 Mon Sep 17 00:00:00 2001 From: Tatsuhiro Tsujikawa Date: Sat, 15 Mar 2008 04:19:46 +0000 Subject: 2008-03-15 Tatsuhiro Tsujikawa Fixed compilation error with g++-4.3 --- src/array_fun.h | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) (limited to 'src/array_fun.h') diff --git a/src/array_fun.h b/src/array_fun.h index 3647b6d8..ccf837a0 100644 --- a/src/array_fun.h +++ b/src/array_fun.h @@ -35,6 +35,7 @@ #ifndef _D_ARRAY_FUN_H_ #define _D_ARRAY_FUN_H_ +#include #include namespace aria2 { @@ -62,7 +63,7 @@ class array_function_base { public: virtual ~array_function_base() {} - virtual R operator[](std::size_t index) const = 0; + virtual R operator[](size_t index) const = 0; virtual array_function_base* clone() const = 0; }; @@ -75,7 +76,7 @@ private: public: array_unary_function(A a, F f):_a(a), _f(f) {} - virtual typename F::result_type operator[](std::size_t index) const + virtual typename F::result_type operator[](size_t index) const { return _f(_a[index]); } @@ -95,7 +96,7 @@ private: public: array_binary_function(A a, B b, F f):_a(a), _b(b), _f(f) {} - virtual typename F::result_type operator[](std::size_t index) const + virtual typename F::result_type operator[](size_t index) const { return _f(_a[index], _b[index]); } @@ -133,7 +134,7 @@ public: return *this; } - R operator[](std::size_t index) const + R operator[](size_t index) const { return (*_p)[index]; } @@ -199,19 +200,17 @@ array_and(A a, B b) // calculate length of array -template +template char (&char_array_ref(T (&)[N]))[N]; -template -std::size_t -arrayLength(T (&a)[N]) +template +size_t arrayLength(T (&a)[N]) { return sizeof(char_array_ref(a)); } template -std::size_t -arrayLength(T (&a)[0u]) +size_t arrayLength(T (&a)[0u]) { return 0; } -- cgit