types: add elems implementation for container types

This commit is contained in:
Danny Robson 2015-10-06 15:20:51 +11:00
parent f7a1ead518
commit e12edc6c0a

View File

@ -25,10 +25,17 @@
//-----------------------------------------------------------------------------
/// Returns the number of elements of a statically allocated array
template <typename T, size_t N>
constexpr size_t elems(const T (&)[N])
constexpr size_t
elems (const T (&)[N])
{ return N; }
template <typename T>
constexpr typename T::size_type
elems (const T &t)
{ return t.size (); }
//-----------------------------------------------------------------------------
template <class T>
T