Phi
is_function.hpp
1 #ifndef INCG_PHI_CORE_TYPE_TRAITS_IS_FUNCTION_HPP
2 #define INCG_PHI_CORE_TYPE_TRAITS_IS_FUNCTION_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/compiler_support/intrinsics/is_function.hpp"
13 #include "phi/type_traits/integral_constant.hpp"
14 
15 #if PHI_SUPPORTS_IS_FUNCTION()
16 
17 DETAIL_PHI_BEGIN_NAMESPACE()
18 
19 template <typename TypeT>
20 struct is_function : public integral_constant<bool, PHI_IS_FUNCTION(TypeT)>
21 {};
22 
23 template <typename TypeT>
24 struct is_not_function : public integral_constant<bool, !PHI_IS_FUNCTION(TypeT)>
25 {};
26 
27 # if PHI_HAS_FEATURE_VARIABLE_TEMPLATE()
28 
29 template <typename TypeT>
30 PHI_INLINE_VARIABLE PHI_CONSTEXPR bool is_function_v = PHI_IS_FUNCTION(TypeT);
31 
32 template <typename TypeT>
33 PHI_INLINE_VARIABLE PHI_CONSTEXPR bool is_not_function_v = !PHI_IS_FUNCTION(TypeT);
34 
35 # endif
36 
37 #else
38 
39 # include "phi/type_traits/is_const.hpp"
40 # include "phi/type_traits/is_reference.hpp"
41 
42 DETAIL_PHI_BEGIN_NAMESPACE()
43 
44 template <typename TypeT>
46  : public integral_constant<bool, !is_const<const TypeT>::value && !is_reference<TypeT>::value>
47 {};
48 
49 template <typename TypeT>
50 struct is_not_function : public integral_constant<bool, !is_function<TypeT>::value>
51 {};
52 
53 # if PHI_HAS_FEATURE_VARIABLE_TEMPLATE()
54 
55 template <typename TypeT>
56 PHI_INLINE_VARIABLE PHI_CONSTEXPR bool is_function_v = is_function<TypeT>::value;
57 
58 template <typename TypeT>
59 PHI_INLINE_VARIABLE PHI_CONSTEXPR bool is_not_function_v = is_not_function<TypeT>::value;
60 
61 # endif
62 
63 #endif
64 
65 DETAIL_PHI_END_NAMESPACE()
66 
67 #endif // INCG_PHI_CORE_TYPE_TRAITS_IS_FUNCTION_HPP
Definition: integral_constant.hpp:19
Definition: is_function.hpp:45
Definition: is_function.hpp:50
Definition: is_const.hpp:40
Definition: is_reference.hpp:40