blob: 88459ec3ab2f41758418eeee6edc8fadfd93b721 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
#ifndef UTL_BASE_H
#define UTL_BASE_H
#include <stdint.h>
#include <stddef.h>
#include <math.h>
namespace utl
{
/**
* @brief Helper to get number of elements in array.
*
* @tparam T Auto-deduced element type
* @tparam N Auto-deduced number of elements
* @return Array size
*/
template <class T, size_t N>
constexpr size_t countof(T (&)[N])
{
return N;
}
} // namespace utl
#endif
|