fixing stuff
[dyninst.git] / dynutil / h / dyn_detail / boost / type_traits / is_pod.hpp
1
2 //  (C) Copyright Steve Cleary, Beman Dawes, Howard Hinnant & John Maddock 2000.
3 //  Use, modification and distribution are subject to the Boost Software License,
4 //  Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
5 //  http://www.boost.org/LICENSE_1_0.txt).
6 //
7 //  See http://www.boost.org/libs/type_traits for most recent version including documentation.
8
9 #ifndef DYN_DETAIL_BOOST_TT_IS_POD_HPP_INCLUDED
10 #define DYN_DETAIL_BOOST_TT_IS_POD_HPP_INCLUDED
11
12 #include <dyn_detail/boost/type_traits/config.hpp>
13 #include <dyn_detail/boost/type_traits/is_void.hpp>
14 #include <dyn_detail/boost/type_traits/is_scalar.hpp>
15 #include <dyn_detail/boost/type_traits/detail/ice_or.hpp>
16 #include <dyn_detail/boost/type_traits/intrinsics.hpp>
17
18 #include <cstddef>
19
20 // should be the last #include
21 #include <dyn_detail/boost/type_traits/detail/bool_trait_def.hpp>
22
23 namespace dyn_detail {
24 namespace boost {
25
26 // forward declaration, needed by 'is_pod_array_helper' template below
27 template< typename T > struct is_POD;
28
29 namespace detail {
30
31 #ifndef DYN_DETAIL_BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
32
33 template <typename T> struct is_pod_impl
34
35     DYN_DETAIL_BOOST_STATIC_CONSTANT(
36         bool, value =
37         (::dyn_detail::boost::type_traits::ice_or<
38             ::dyn_detail::boost::is_scalar<T>::value,
39             ::dyn_detail::boost::is_void<T>::value,
40             DYN_DETAIL_BOOST_IS_POD(T)
41          >::value));
42 };
43
44 #if !defined(DYN_DETAIL_BOOST_NO_ARRAY_TYPE_SPECIALIZATIONS)
45 template <typename T, std::size_t sz>
46 struct is_pod_impl<T[sz]>
47     : is_pod_impl<T>
48 {
49 };
50 #endif
51
52 #else
53
54 template <bool is_array = false>
55 struct is_pod_helper
56 {
57     template <typename T> struct result_
58     {
59         DYN_DETAIL_BOOST_STATIC_CONSTANT(
60             bool, value =
61             (::dyn_detail::boost::type_traits::ice_or<
62                 ::dyn_detail::boost::is_scalar<T>::value,
63                 ::dyn_detail::boost::is_void<T>::value,
64                 DYN_DETAIL_BOOST_IS_POD(T)
65             >::value));
66     };
67 };
68
69 template <bool b>
70 struct bool_to_yes_no_type
71 {
72         typedef ::dyn_detail::boost::type_traits::no_type type;
73 };
74
75 template <>
76 struct bool_to_yes_no_type<true>
77 {
78         typedef ::dyn_detail::boost::type_traits::yes_type type;
79 };
80
81 template <typename ArrayType>
82 struct is_pod_array_helper
83 {
84     enum { is_pod = ::dyn_detail::boost::is_POD<ArrayType>::value }; // MSVC workaround
85     typedef typename bool_to_yes_no_type<is_pod>::type type;
86     type instance() const;
87 };
88
89 template <typename T>
90 is_pod_array_helper<T> is_POD_array(T*);
91
92 template <>
93 struct is_pod_helper<true>
94 {
95     template <typename T> struct result_
96     {
97         static T& help();
98         DYN_DETAIL_BOOST_STATIC_CONSTANT(bool, value =
99             sizeof(is_POD_array(help()).instance()) == sizeof(::dyn_detail::boost::type_traits::yes_type)
100             );
101     };
102 };
103
104
105 template <typename T> struct is_pod_impl
106
107    DYN_DETAIL_BOOST_STATIC_CONSTANT(
108        bool, value = (
109            ::dyn_detail::boost::detail::is_pod_helper<
110               ::dyn_detail::boost::is_array<T>::value
111            >::template result_<T>::value
112            )
113        );
114 };
115
116 #endif // DYN_DETAIL_BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
117
118 // the following help compilers without partial specialization support:
119 DYN_DETAIL_BOOST_TT_AUX_BOOL_TRAIT_IMPL_SPEC1(is_pod,void,true)
120
121 #ifndef DYN_DETAIL_BOOST_NO_CV_VOID_SPECIALIZATIONS
122 DYN_DETAIL_BOOST_TT_AUX_BOOL_TRAIT_IMPL_SPEC1(is_pod,void const,true)
123 DYN_DETAIL_BOOST_TT_AUX_BOOL_TRAIT_IMPL_SPEC1(is_pod,void volatile,true)
124 DYN_DETAIL_BOOST_TT_AUX_BOOL_TRAIT_IMPL_SPEC1(is_pod,void const volatile,true)
125 #endif
126
127 } // namespace detail
128
129 DYN_DETAIL_BOOST_TT_AUX_BOOL_TRAIT_DEF1(is_POD,T,::dyn_detail::boost::detail::is_pod_impl<T>::value)
130 DYN_DETAIL_BOOST_TT_AUX_BOOL_TRAIT_DEF1(is_pod,T,::dyn_detail::boost::detail::is_pod_impl<T>::value)
131
132 } // namespace boost
133 } // namespace dyn_detail
134
135 #include <dyn_detail/boost/type_traits/detail/bool_trait_undef.hpp>
136
137 #endif // DYN_DETAIL_BOOST_TT_IS_POD_HPP_INCLUDED