CppCommon  1.0.4.1
C++ Common Library
countof.h
Go to the documentation of this file.
1 
9 #ifndef CPPCOMMON_UTILITY_COUNTOF_H
10 #define CPPCOMMON_UTILITY_COUNTOF_H
11 
12 namespace CppCommon {
13 
15 template <typename T, size_t N>
16 constexpr size_t countof(const T (&)[N]) noexcept { return N; }
17 
19 template <typename T>
20 size_t countof(const T& container) noexcept { return container.size(); }
21 
22 } // namespace CppCommon
23 
24 #endif // CPPCOMMON_UTILITY_COUNTOF_H
C++ Common project definitions.
Definition: token_bucket.h:15
constexpr size_t countof(const T(&)[N]) noexcept
Count of elements in static array.
Definition: countof.h:16