Phi
is_safe_integer.hpp
1 #ifndef INCG_PHI_CORE_TYPE_TRAITS_IS_SAFE_INTEGER_HPP
2 #define INCG_PHI_CORE_TYPE_TRAITS_IS_SAFE_INTEGER_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 template <typename TypeT>
18 class integer;
19 
20 namespace detail
21 {
22  template <typename TypeT>
24  {};
25 
26  template <typename TypeT>
27  struct is_safe_integer_impl<integer<TypeT>> : public true_type
28  {};
29 } // namespace detail
30 
31 template <typename TypeT>
32 struct is_safe_integer : public detail::is_safe_integer_impl<remove_cv_t<TypeT>>
33 {};
34 
35 template <typename TypeT>
36 struct is_not_safe_integer : public integral_constant<bool, !is_safe_integer<TypeT>::value>
37 {};
38 
39 #if PHI_HAS_FEATURE_VARIABLE_TEMPLATE()
40 
41 template <typename TypeT>
42 PHI_INLINE_VARIABLE PHI_CONSTEXPR bool is_safe_integer_v = is_safe_integer<TypeT>::value;
43 
44 template <typename TypeT>
45 PHI_INLINE_VARIABLE PHI_CONSTEXPR bool is_not_safe_integer_v = is_not_safe_integer<TypeT>::value;
46 
47 #endif
48 
49 DETAIL_PHI_END_NAMESPACE()
50 
51 #endif // INCG_PHI_CORE_TYPE_TRAITS_IS_SAFE_INTEGER_HPP
Definition: integral_constant.hpp:19
Definition: is_safe_integer.hpp:23
A type safe integer class.
Definition: integer.hpp:58
Definition: is_safe_integer.hpp:32
Definition: swap.hpp:23
Definition: is_safe_integer.hpp:36