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