M5Utility 0.0.2 git rev:5c1a751
Loading...
Searching...
No Matches
extension.hpp
1
11#ifndef M5_UTILITY_STL_EXTENSION_HPP
12#define M5_UTILITY_STL_EXTENSION_HPP
13
14#include <cstddef>
15#include <type_traits>
16
17namespace m5 {
18namespace stl {
19
21template <class C>
22constexpr auto size(const C& c) -> decltype(c.size())
23{
24 return c.size();
25}
26
28template <typename T, size_t N>
29constexpr auto size(const T (&)[N]) noexcept -> size_t
30{
31 return N;
32}
33
41template <typename E>
42constexpr inline typename std::underlying_type<E>::type to_underlying(const E e) noexcept
43{
44 return static_cast<typename std::underlying_type<E>::type>(e);
45}
46
47} // namespace stl
48} // namespace m5
49
50#endif
Top level namespace of M5.
Definition bit_segment.hpp:17
STL compatibility functions and classes.