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).
7 // See http://www.boost.org/libs/type_traits for most recent version including documentation.
9 #ifndef BOOST_TT_IS_POD_HPP_INCLUDED
10 #define BOOST_TT_IS_POD_HPP_INCLUDED
12 #include <boost/type_traits/config.hpp>
13 #include <boost/type_traits/is_void.hpp>
14 #include <boost/type_traits/is_scalar.hpp>
15 #include <boost/type_traits/detail/ice_or.hpp>
16 #include <boost/type_traits/intrinsics.hpp>
20 // should be the last #include
21 #include <boost/type_traits/detail/bool_trait_def.hpp>
25 // forward declaration, needed by 'is_pod_array_helper' template below
26 template< typename T
> struct is_POD
;
30 #ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
32 template <typename T
> struct is_pod_impl
34 BOOST_STATIC_CONSTANT(
36 (::boost::type_traits::ice_or
<
37 ::boost::is_scalar
<T
>::value
,
38 ::boost::is_void
<T
>::value
,
43 #if !defined(BOOST_NO_ARRAY_TYPE_SPECIALIZATIONS)
44 template <typename T
, std::size_t sz
>
45 struct is_pod_impl
<T
[sz
]>
53 template <bool is_array
= false>
56 template <typename T
> struct result_
58 BOOST_STATIC_CONSTANT(
60 (::boost::type_traits::ice_or
<
61 ::boost::is_scalar
<T
>::value
,
62 ::boost::is_void
<T
>::value
,
69 struct bool_to_yes_no_type
71 typedef ::boost::type_traits::no_type type
;
75 struct bool_to_yes_no_type
<true>
77 typedef ::boost::type_traits::yes_type type
;
80 template <typename ArrayType
>
81 struct is_pod_array_helper
83 enum { is_pod
= ::boost::is_POD
<ArrayType
>::value
}; // MSVC workaround
84 typedef typename bool_to_yes_no_type
<is_pod
>::type type
;
85 type
instance() const;
89 is_pod_array_helper
<T
> is_POD_array(T
*);
92 struct is_pod_helper
<true>
94 template <typename T
> struct result_
97 BOOST_STATIC_CONSTANT(bool, value
=
98 sizeof(is_POD_array(help()).instance()) == sizeof(::boost::type_traits::yes_type
)
104 template <typename T
> struct is_pod_impl
106 BOOST_STATIC_CONSTANT(
108 ::boost::detail::is_pod_helper
<
109 ::boost::is_array
<T
>::value
110 >::template result_
<T
>::value
115 #endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
117 // the following help compilers without partial specialization support:
118 BOOST_TT_AUX_BOOL_TRAIT_IMPL_SPEC1(is_pod
,void,true)
120 #ifndef BOOST_NO_CV_VOID_SPECIALIZATIONS
121 BOOST_TT_AUX_BOOL_TRAIT_IMPL_SPEC1(is_pod
,void const,true)
122 BOOST_TT_AUX_BOOL_TRAIT_IMPL_SPEC1(is_pod
,void volatile,true)
123 BOOST_TT_AUX_BOOL_TRAIT_IMPL_SPEC1(is_pod
,void const volatile,true)
126 } // namespace detail
128 BOOST_TT_AUX_BOOL_TRAIT_DEF1(is_POD
,T
,::boost::detail::is_pod_impl
<T
>::value
)
129 BOOST_TT_AUX_BOOL_TRAIT_DEF1(is_pod
,T
,::boost::detail::is_pod_impl
<T
>::value
)
133 #include <boost/type_traits/detail/bool_trait_undef.hpp>
135 #endif // BOOST_TT_IS_POD_HPP_INCLUDED