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// SPDX-FileCopyrightText: Copyright (C) 2019 Tobias Hienzsch
3
4#ifndef TETL_TYPE_TRAITS_IS_SCALAR_HPP
5#define TETL_TYPE_TRAITS_IS_SCALAR_HPP
6
7#include <etl/_config/all.hpp>
8
9#include <etl/_type_traits/bool_constant.hpp>
10#include <etl/_type_traits/is_arithmetic.hpp>
11#include <etl/_type_traits/is_enum.hpp>
12#include <etl/_type_traits/is_member_pointer.hpp>
13#include <etl/_type_traits/is_null_pointer.hpp>
14#include <etl/_type_traits/is_pointer.hpp>
15
16namespace etl {
17
18/// \brief If T is a scalar type (that is a possibly cv-qualified arithmetic,
19/// pointer, pointer to member, enumeration, or etl::nullptr_t type), provides
20/// the member constant value equal true. For any other type, value is false.
21template <typename T>
22struct is_scalar;
23
24#if __has_builtin(__is_scalar)
25
26template <typename T>
27struct is_scalar : bool_constant<__is_scalar(T)> { };
28
29template <typename T>
30
31inline constexpr bool is_scalar_v = __is_scalar(T);
32#else
33
34template <typename T>
38 > { };
39
40template <typename T>
41
42inline constexpr bool is_scalar_v = is_scalar<T>::value;
43
44#endif
45
46} // namespace etl
47
48#endif // TETL_TYPE_TRAITS_IS_SCALAR_HPP
Definition adjacent_find.hpp:9