tetl 0.1.0
Embedded Template Library
Loading...
Searching...
No Matches
is_floating_point.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_FLOATING_POINT_HPP
5#define TETL_TYPE_TRAITS_IS_FLOATING_POINT_HPP
6
7#include <etl/_mpl/contains.hpp>
8#include <etl/_type_traits/bool_constant.hpp>
9#include <etl/_type_traits/remove_cv.hpp>
10
11namespace etl {
12
13/// \brief Checks whether T is a floating-point type. Provides the member
14/// constant value which is equal to true, if T is the type float, double, long
15/// double, including any cv-qualified variants. Otherwise, value is equal to
16/// false.
17///
18/// \details The behavior of a program that adds specializations for
19/// is_floating_point or is_floating_point_v is undefined.
20template <typename T>
21struct is_floating_point : bool_constant<mpl::contains_v<remove_cv_t<T>, mpl::list<float, double, long double>>> { };
22
23template <typename T>
24inline constexpr bool is_floating_point_v = is_floating_point<T>::value;
25
26} // namespace etl
27
28#endif // TETL_TYPE_TRAITS_IS_FLOATING_POINT_HPP
Definition at.hpp:10
Definition adjacent_find.hpp:9
constexpr bool is_floating_point_v
Definition is_floating_point.hpp:24
Definition list.hpp:11