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 BOOST_TT_IS_POD_HPP_INCLUDED |
10 | #define BOOST_TT_IS_POD_HPP_INCLUDED |
11 | |
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> |
17 | |
18 | #include <cstddef> |
19 | |
20 | // should be the last #include |
21 | #include <boost/type_traits/detail/bool_trait_def.hpp> |
22 | |
23 | #ifndef BOOST_IS_POD |
24 | #define BOOST_INTERNAL_IS_POD(T) false |
25 | #else |
26 | #define BOOST_INTERNAL_IS_POD(T) BOOST_IS_POD(T) |
27 | #endif |
28 | |
29 | namespace boost { |
30 | |
31 | // forward declaration, needed by 'is_pod_array_helper' template below |
32 | template< typename T > struct is_POD; |
33 | |
34 | namespace detail { |
35 | |
36 | |
37 | template <typename T> struct is_pod_impl |
38 | { |
39 | BOOST_STATIC_CONSTANT( |
40 | bool, value = |
41 | (::boost::type_traits::ice_or< |
42 | ::boost::is_scalar<T>::value, |
43 | ::boost::is_void<T>::value, |
44 | BOOST_INTERNAL_IS_POD(T) |
45 | >::value)); |
46 | }; |
47 | |
48 | #if !defined(BOOST_NO_ARRAY_TYPE_SPECIALIZATIONS) |
49 | template <typename T, std::size_t sz> |
50 | struct is_pod_impl<T[sz]> |
51 | : public is_pod_impl<T> |
52 | { |
53 | }; |
54 | #endif |
55 | |
56 | |
57 | // the following help compilers without partial specialization support: |
58 | BOOST_TT_AUX_BOOL_TRAIT_IMPL_SPEC1(is_pod,void,true) |
59 | |
60 | #ifndef BOOST_NO_CV_VOID_SPECIALIZATIONS |
61 | BOOST_TT_AUX_BOOL_TRAIT_IMPL_SPEC1(is_pod,void const,true) |
62 | BOOST_TT_AUX_BOOL_TRAIT_IMPL_SPEC1(is_pod,void volatile,true) |
63 | BOOST_TT_AUX_BOOL_TRAIT_IMPL_SPEC1(is_pod,void const volatile,true) |
64 | #endif |
65 | |
66 | } // namespace detail |
67 | |
68 | BOOST_TT_AUX_BOOL_TRAIT_DEF1(is_pod,T,::boost::detail::is_pod_impl<T>::value) |
69 | // is_POD is the old depricated name for this trait, do not use this as it may |
70 | // be removed in future without warning!! |
71 | BOOST_TT_AUX_BOOL_TRAIT_DEF1(is_POD,T,::boost::is_pod<T>::value) |
72 | |
73 | } // namespace boost |
74 | |
75 | #include <boost/type_traits/detail/bool_trait_undef.hpp> |
76 | |
77 | #undef BOOST_INTERNAL_IS_POD |
78 | |
79 | #endif // BOOST_TT_IS_POD_HPP_INCLUDED |
80 | |