2
// (C) Copyright Steve Cleary, Beman Dawes, Howard Hinnant & John Maddock 2000.
3
// Permission to copy, use, modify, sell and distribute this software is
4
// granted provided this copyright notice appears in all copies. This software
5
// is provided "as is" without express or implied warranty, and with no claim
6
// as to its suitability for any purpose.
8
// See http://www.boost.org for most recent version including documentation.
10
#ifndef BOOST_TT_IS_POD_HPP_INCLUDED
11
#define BOOST_TT_IS_POD_HPP_INCLUDED
13
#include "boost/type_traits/config.hpp"
14
#include "boost/type_traits/is_void.hpp"
15
#include "boost/type_traits/is_scalar.hpp"
16
#include "boost/type_traits/detail/ice_or.hpp"
17
#include "boost/type_traits/intrinsics.hpp"
21
// should be the last #include
22
#include "boost/type_traits/detail/bool_trait_def.hpp"
26
// forward declaration, needed by 'is_pod_array_helper' template below
27
template< typename T > struct is_POD;
31
#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
33
template <typename T> struct is_pod_impl
35
BOOST_STATIC_CONSTANT(
37
(::boost::type_traits::ice_or<
38
::boost::is_scalar<T>::value,
39
::boost::is_void<T>::value,
44
template <typename T, std::size_t sz>
45
struct is_pod_impl<T[sz]>
52
template <bool is_array = false>
55
template <typename T> struct result_
57
BOOST_STATIC_CONSTANT(
59
(::boost::type_traits::ice_or<
60
::boost::is_scalar<T>::value,
61
::boost::is_void<T>::value,
68
struct bool_to_yes_no_type
70
typedef ::boost::type_traits::no_type type;
74
struct bool_to_yes_no_type<true>
76
typedef ::boost::type_traits::yes_type type;
79
template <typename ArrayType>
80
struct is_pod_array_helper
82
enum { is_pod = ::boost::is_POD<ArrayType>::value }; // MSVC workaround
83
typedef typename bool_to_yes_no_type<is_pod>::type type;
84
type instance() const;
88
is_pod_array_helper<T> is_POD_array(T*);
91
struct is_pod_helper<true>
93
template <typename T> struct result_
96
BOOST_STATIC_CONSTANT(bool, value =
97
sizeof(is_POD_array(help()).instance()) == sizeof(::boost::type_traits::yes_type)
103
template <typename T> struct is_pod_impl
105
BOOST_STATIC_CONSTANT(
107
::boost::detail::is_pod_helper<
108
::boost::is_array<T>::value
109
>::template result_<T>::value
114
#endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
116
// the following help compilers without partial specialization support:
117
BOOST_TT_AUX_BOOL_TRAIT_IMPL_SPEC1(is_pod,void,true)
119
#ifndef BOOST_NO_CV_VOID_SPECIALIZATIONS
120
BOOST_TT_AUX_BOOL_TRAIT_IMPL_SPEC1(is_pod,void const,true)
121
BOOST_TT_AUX_BOOL_TRAIT_IMPL_SPEC1(is_pod,void volatile,true)
122
BOOST_TT_AUX_BOOL_TRAIT_IMPL_SPEC1(is_pod,void const volatile,true)
125
} // namespace detail
127
BOOST_TT_AUX_BOOL_TRAIT_DEF1(is_POD,T,::boost::detail::is_pod_impl<T>::value)
128
BOOST_TT_AUX_BOOL_TRAIT_DEF1(is_pod,T,::boost::is_POD<T>::value)
132
#include "boost/type_traits/detail/bool_trait_undef.hpp"
134
#endif // BOOST_TT_IS_POD_HPP_INCLUDED