tetl 0.1.0
Embedded Template Library
Loading...
Searching...
No Matches
is_integral.hpp
Go to the documentation of this file.
1// SPDX-License-Identifier: BSL-1.0
2// SPDX-FileCopyrightText: Copyright (C) 2021 Tobias Hienzsch
3
4#ifndef TETL_TYPE_TRAITS_IS_INTEGRAL_HPP
5#define TETL_TYPE_TRAITS_IS_INTEGRAL_HPP
6
7#include <etl/_type_traits/bool_constant.hpp>
8
9#if __has_builtin(__is_integral)
10namespace etl {
11
12template <typename T>
13struct is_integral : bool_constant<__is_integral(T)> { };
14
15template <typename T>
16
17inline constexpr bool is_integral_v = __is_integral(T);
18
19} // namespace etl
20
21#else
22
23 #include <etl/_mpl/contains.hpp>
24 #include <etl/_type_traits/remove_cv.hpp>
25
26namespace etl {
27
28template <typename T>
29inline constexpr bool is_integral_v = mpl::contains_v<
30 remove_cv_t<T>,
31 mpl::list<
32 bool,
33 char,
34 signed char,
35 unsigned char,
36 wchar_t,
37 char8_t,
38 char16_t,
39 char32_t,
40 short,
41 unsigned short,
42 int,
43 unsigned int,
44 long,
45 unsigned long,
46 long long,
47 unsigned long long
48 >
49>;
50
51template <typename T>
52struct is_integral : bool_constant<is_integral_v<T> > { };
53
54} // namespace etl
55
56#endif
57
58#endif // TETL_TYPE_TRAITS_IS_INTEGRAL_HPP
Definition adjacent_find.hpp:9