tetl 0.1.0
Embedded Template Library
Loading...
Searching...
No Matches
underlying_type.hpp
Go to the documentation of this file.
1// SPDX-License-Identifier: BSL-1.0
2
3#ifndef TETL_TYPE_TRAITS_IS_UNDERLYING_TYPE_HPP
4#define TETL_TYPE_TRAITS_IS_UNDERLYING_TYPE_HPP
5
6#include <etl/_config/all.hpp>
7
9
10namespace etl {
11
12namespace detail {
13template <typename T>
14struct underlying_type { };
15
16template <typename T>
17 requires is_enum_v<T>
18struct underlying_type<T> {
19 using type = __underlying_type(T);
20};
21
22} // namespace detail
23
26template <typename T>
27struct underlying_type : detail::underlying_type<T> { };
28
30template <typename T>
31using underlying_type_t = typename underlying_type<T>::type;
32
33} // namespace etl
34
35#endif // TETL_TYPE_TRAITS_IS_UNDERLYING_TYPE_HPP
typename underlying_type< T >::type underlying_type_t
Definition underlying_type.hpp:31
Definition adjacent_find.hpp:8
constexpr bool is_enum_v
Definition is_enum.hpp:16
The underlying type of an enum.
Definition underlying_type.hpp:27