tetl 0.1.0
Embedded Template Library
Loading...
Searching...
No Matches
is_scalar.hpp
Go to the documentation of this file.
1// SPDX-License-Identifier: BSL-1.0
2
3#ifndef TETL_TYPE_TRAITS_IS_SCALAR_HPP
4#define TETL_TYPE_TRAITS_IS_SCALAR_HPP
5
6#include <etl/_config/all.hpp>
7
14
15namespace etl {
16
20template <typename T>
21struct is_scalar;
22
23#if __has_builtin(__is_scalar)
24
25template <typename T>
26struct is_scalar : bool_constant<__is_scalar(T)> { };
27
28template <typename T>
29
30inline constexpr bool is_scalar_v = __is_scalar(T);
31#else
32
33template <typename T>
36 is_arithmetic_v<T> or is_enum_v<T> or is_pointer_v<T> or is_member_pointer_v<T> or is_null_pointer_v<T> > { };
37
38template <typename T>
39
40inline constexpr bool is_scalar_v = is_scalar<T>::value;
41
42#endif
43
44} // namespace etl
45
46#endif // TETL_TYPE_TRAITS_IS_SCALAR_HPP
Definition adjacent_find.hpp:8
constexpr bool is_scalar_v
Definition is_scalar.hpp:40
integral_constant< bool, B > bool_constant
Definition bool_constant.hpp:11
static constexpr bool value
Definition integral_constant.hpp:10
If T is a scalar type (that is a possibly cv-qualified arithmetic, pointer, pointer to member,...
Definition is_scalar.hpp:36