diff --git a/test/float.cpp b/test/float.cpp index 81b8c45d..0a94ab3c 100644 --- a/test/float.cpp +++ b/test/float.cpp @@ -1,12 +1,12 @@ #include "../float.hpp" #include "../debug.hpp" +#include "../types.hpp" + #include using namespace std; -#define elems(x) (sizeof(x) / sizeof(0[x])) - void test_double (void) { diff --git a/types.hpp b/types.hpp index afee0e5a..dbbd9922 100644 --- a/types.hpp +++ b/types.hpp @@ -92,5 +92,9 @@ sign_cast (const typename sign_types::with_sign v) } +/// Returns the number of elements of a statically allocated array +template +size_t elems(T (&)[N]) + { return N; } #endif // __TYPES_HPP