Phi
is_unsafe_floating_point.hpp
1 #ifndef INCG_PHI_CORE_TYPE_TRAITS_IS_UNSAFE_FLOATING_POINT_HPP
2 #define INCG_PHI_CORE_TYPE_TRAITS_IS_UNSAFE_FLOATING_POINT_HPP
3 
4 #include "phi/phi_config.hpp"
5 
6 #if PHI_HAS_EXTENSION_PRAGMA_ONCE()
7 # pragma once
8 #endif
9 
10 #include "phi/compiler_support/constexpr.hpp"
11 #include "phi/compiler_support/inline_variables.hpp"
12 #include "phi/type_traits/integral_constant.hpp"
13 #include "phi/type_traits/remove_cv.hpp"
14 
15 DETAIL_PHI_BEGIN_NAMESPACE()
16 
17 namespace detail
18 {
19  template <typename TypeT>
21  {};
22 
23  // Standard C++ floating point types
24  template <>
26  {};
27 
28  template <>
29  struct is_unsafe_floating_point_impl<double> : public true_type
30  {};
31 
32  template <>
33  struct is_unsafe_floating_point_impl<long double> : public true_type
34  {};
35 
36 #if 0 // TODO:
37  // Extended floating point types
38 # if PHI_HAS_EXTENSION_FLOAT16()
39  template <>
40  struct is_unsafe_floating_point_impl<_Float16> : public true_type
41  {};
42 # endif
43 
44 # if PHI_HAS_EXTENSION_FP16()
45  template <>
46  struct is_unsafe_floating_point_impl<__fp16> : public true_type
47  {};
48 # endif
49 
50 # if PHI_HAS_EXTENSION_FLOAT128()
51  template <>
52  struct is_unsafe_floating_point_impl<__float128> : public true_type
53  {};
54 # endif
55 #endif
56 } // namespace detail
57 
58 template <typename TypeT>
60 {};
61 
62 template <typename TypeT>
64  : public integral_constant<bool, !is_unsafe_floating_point<TypeT>::value>
65 {};
66 
67 #if PHI_HAS_FEATURE_VARIABLE_TEMPLATE()
68 
69 template <typename TypeT>
70 PHI_INLINE_VARIABLE PHI_CONSTEXPR bool is_unsafe_floating_point_v =
72 
73 template <typename TypeT>
74 PHI_INLINE_VARIABLE PHI_CONSTEXPR bool is_not_unsafe_floating_point_v =
76 
77 #endif
78 
79 DETAIL_PHI_END_NAMESPACE()
80 
81 #endif // INCG_PHI_CORE_TYPE_TRAITS_IS_UNSAFE_FLOATING_POINT_HPP
Definition: integral_constant.hpp:19
Definition: is_unsafe_floating_point.hpp:63
Definition: swap.hpp:23
Definition: is_unsafe_floating_point.hpp:20
Definition: is_unsafe_floating_point.hpp:59