tetl 0.1.0
Embedded Template Library
Loading...
Searching...
No Matches
is_scoped_enum.hpp
Go to the documentation of this file.
1// SPDX-License-Identifier: BSL-1.0
2// SPDX-FileCopyrightText: Copyright (C) 2019 Tobias Hienzsch
3
4#ifndef TETL_TYPE_TRAITS_IS_SCOPED_ENUM_HPP
5#define TETL_TYPE_TRAITS_IS_SCOPED_ENUM_HPP
6
7#include <etl/_type_traits/bool_constant.hpp>
8#include <etl/_type_traits/is_convertible.hpp>
9#include <etl/_type_traits/is_enum.hpp>
10#include <etl/_type_traits/underlying_type.hpp>
11
12namespace etl {
13
14template <typename T>
15struct is_scoped_enum : false_type { };
16
17template <typename T>
18 requires is_enum_v<T>
19struct is_scoped_enum<T> : bool_constant<not is_convertible_v<T, underlying_type_t<T>>> { };
20
21/// \brief Checks whether T is an scoped enumeration type. Provides the member
22/// constant value which is equal to true, if T is an scoped enumeration type.
23/// Otherwise, value is equal to false. The behavior of a program that adds
24/// specializations for is_scoped_enum or is_scoped_enum_v is undefined.
25///
26/// https://en.cppreference.com/w/cpp/types/is_scoped_enum
27template <typename T>
28inline constexpr bool is_scoped_enum_v = is_scoped_enum<T>::value;
29
30} // namespace etl
31
32#endif // TETL_TYPE_TRAITS_IS_SCOPED_ENUM_HPP
Definition adjacent_find.hpp:9
constexpr bool is_scoped_enum_v
Checks whether T is an scoped enumeration type. Provides the member constant value which is equal to ...
Definition is_scoped_enum.hpp:28
Definition is_scoped_enum.hpp:15