Phi
has_difference_type.hpp
1 #ifndef INCG_PHI_TYPE_TRAITS_HAS_DIFFERENCE_TYPE_HPP
2 #define INCG_PHI_TYPE_TRAITS_HAS_DIFFERENCE_TYPE_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/void_t.hpp"
14 
15 DETAIL_PHI_BEGIN_NAMESPACE()
16 
17 template <typename TypeT, typename = void>
19 {};
20 
21 template <typename TypeT>
22 struct has_difference_type<TypeT, void_t<typename TypeT::difference_type>> : public true_type
23 {};
24 
25 template <typename TypeT>
26 struct has_no_difference_type : public integral_constant<bool, !has_difference_type<TypeT>::value>
27 {};
28 
29 #if PHI_HAS_FEATURE_VARIABLE_TEMPLATE()
30 
31 template <typename TypeT>
32 PHI_INLINE_VARIABLE PHI_CONSTEXPR bool has_difference_type_v = has_difference_type<TypeT>::value;
33 
34 template <typename TypeT>
35 PHI_INLINE_VARIABLE PHI_CONSTEXPR bool has_no_difference_type_v =
37 
38 #endif
39 
40 DETAIL_PHI_END_NAMESPACE()
41 
42 #endif // INCG_PHI_TYPE_TRAITS_HAS_DIFFERENCE_TYPE_HPP
Definition: integral_constant.hpp:19
A type safe integer class.
Definition: integer.hpp:58
Definition: has_difference_type.hpp:26
Definition: has_difference_type.hpp:18