diff --git a/types.hpp b/types.hpp index 1af648d4..55e28795 100644 --- a/types.hpp +++ b/types.hpp @@ -25,10 +25,17 @@ //----------------------------------------------------------------------------- /// Returns the number of elements of a statically allocated array template -constexpr size_t elems(const T (&)[N]) +constexpr size_t +elems (const T (&)[N]) { return N; } +template +constexpr typename T::size_type +elems (const T &t) + { return t.size (); } + + //----------------------------------------------------------------------------- template T