| 1 | #pragma once |
|---|---|
| 2 | |
| 3 | #include <cstdlib> |
| 4 | |
| 5 | |
| 6 | namespace ext |
| 7 | { |
| 8 | /** \brief Returns number of elements in an automatic array. */ |
| 9 | template <typename T, std::size_t N> |
| 10 | constexpr std::size_t size(const T (&)[N]) noexcept { return N; } |
| 11 | |
| 12 | /** \brief Returns number of in a container providing size() member function. */ |
| 13 | template <typename T> constexpr auto size(const T & t) { return t.size(); } |
| 14 | } |
| 15 |