Skip to content
This repository was archived by the owner on Jul 25, 2022. It is now read-only.

Commit ed8b09b

Browse files
committed
Add size() function to get size of arrays.
Source: https://en.cppreference.com/w/cpp/iterator/size
1 parent 7226255 commit ed8b09b

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#ifndef ROBOT_CONTROL_SRC_LIBRARY_EXTENSION_HPP_
2+
#define ROBOT_CONTROL_SRC_LIBRARY_EXTENSION_HPP_
3+
4+
#include <cstddef>
5+
6+
template <class T, std::size_t N>
7+
constexpr std::size_t size(const T (&)[N]) noexcept
8+
{
9+
return N;
10+
}
11+
12+
#endif /* ROBOT_CONTROL_SRC_LIBRARY_EXTENSION_HPP_ */

0 commit comments

Comments
 (0)