Phi
is_aggregate.hpp
1 #ifndef INCG_PHI_CORE_TYPE_TRAITS_IS_AGGREGATE_HPP
2 #define INCG_PHI_CORE_TYPE_TRAITS_IS_AGGREGATE_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_aggregate.hpp"
13 #include "phi/type_traits/integral_constant.hpp"
14 
15 #if PHI_SUPPORTS_IS_AGGREGATE()
16 
17 # include "phi/type_traits/remove_cv.hpp"
18 
19 # define PHI_HAS_WORKING_IS_AGGREGATE() 1
20 
21 DETAIL_PHI_BEGIN_NAMESPACE()
22 
23 template <typename TypeT>
24 struct is_aggregate : public integral_constant<bool, PHI_IS_AGGREGATE(remove_cv_t<TypeT>)>
25 {};
26 
27 template <typename TypeT>
28 struct is_not_aggregate : public integral_constant<bool, !PHI_IS_AGGREGATE(remove_cv_t<TypeT>)>
29 {};
30 
31 # if PHI_HAS_FEATURE_VARIABLE_TEMPLATE()
32 
33 template <typename TypeT>
34 PHI_INLINE_VARIABLE PHI_CONSTEXPR bool is_aggregate_v = PHI_IS_AGGREGATE(remove_cv_t<TypeT>);
35 
36 template <typename TypeT>
37 PHI_INLINE_VARIABLE PHI_CONSTEXPR bool is_not_aggregate_v = !PHI_IS_AGGREGATE(remove_cv_t<TypeT>);
38 
39 # endif
40 
41 #else
42 
43 # include "phi/type_traits/false_t.hpp"
44 
45 # define PHI_HAS_WORKING_IS_AGGREGATE() 0
46 
47 DETAIL_PHI_BEGIN_NAMESPACE()
48 
49 template <typename TypeT>
50 struct is_aggregate : public false_type
51 {
52  static_assert(false_t<TypeT>::value,
53  "phi::is_aggregate requires compiler support for intrinsic __is_aggregate");
54 };
55 
56 template <typename TypeT>
58 {
59  static_assert(false_t<TypeT>::value,
60  "phi::is_not_aggregate requires compiler support for intrinsic __is_aggregate");
61 };
62 
63 # if PHI_HAS_FEATURE_VARIABLE_TEMPLATE()
64 
65 template <typename TypeT>
66 PHI_INLINE_VARIABLE PHI_CONSTEXPR bool is_aggregate_v = is_aggregate<TypeT>::value;
67 
68 template <typename TypeT>
69 PHI_INLINE_VARIABLE PHI_CONSTEXPR bool is_not_aggregate_v = is_not_aggregate<TypeT>::value;
70 
71 # endif
72 
73 #endif
74 
75 DETAIL_PHI_END_NAMESPACE()
76 
77 #endif // INCG_PHI_CORE_TYPE_TRAITS_IS_AGGREGATE_HPP
Definition: integral_constant.hpp:19
Definition: false_t.hpp:29
Definition: is_aggregate.hpp:57
Definition: is_aggregate.hpp:50