tetl 0.1.0
Embedded Template Library
Loading...
Searching...
No Matches
to_underlying.hpp
Go to the documentation of this file.
1// SPDX-License-Identifier: BSL-1.0
2
3#ifndef TETL_UTILITY_TO_UNDERLYING_HPP
4#define TETL_UTILITY_TO_UNDERLYING_HPP
5
7
8namespace etl {
9
13template <typename Enum>
14[[nodiscard]] constexpr auto to_underlying(Enum e) noexcept -> underlying_type_t<Enum>
15{
16 return static_cast<underlying_type_t<Enum>>(e);
17}
18
19} // namespace etl
20
21#endif // TETL_UTILITY_TO_UNDERLYING_HPP
typename underlying_type< T >::type underlying_type_t
Definition underlying_type.hpp:31
Definition adjacent_find.hpp:8
constexpr auto to_underlying(Enum e) noexcept -> underlying_type_t< Enum >
Converts an enumeration to its underlying type.
Definition to_underlying.hpp:14