You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
18 lines
348 B
C++
18 lines
348 B
C++
/*! \file
|
|
* \brief Template function to determine the length of an array
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include "../types.h"
|
|
|
|
/* \brief Helper to retrieve the number of elements in an array
|
|
* (Warning: template magic)
|
|
* \param Array
|
|
* \return Number of elements
|
|
*/
|
|
template <class T, size_t N>
|
|
constexpr size_t size(T (& /*unused*/)[N]) {
|
|
return N;
|
|
}
|