Imported Upstream version 1.57.0
[platform/upstream/boost.git] / boost / type_traits / has_trivial_copy.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 BOOST_TT_HAS_TRIVIAL_COPY_HPP_INCLUDED
10 #define BOOST_TT_HAS_TRIVIAL_COPY_HPP_INCLUDED
11
12 #include <boost/type_traits/config.hpp>
13 #include <boost/type_traits/intrinsics.hpp>
14 #include <boost/type_traits/is_volatile.hpp>
15 #include <boost/type_traits/is_pod.hpp>
16 #include <boost/type_traits/detail/ice_and.hpp>
17 #include <boost/type_traits/detail/ice_or.hpp>
18 #include <boost/type_traits/detail/ice_not.hpp>
19
20 #ifdef __clang__
21 #include <boost/type_traits/is_copy_constructible.hpp>
22 #endif
23
24 // should be the last #include
25 #include <boost/type_traits/detail/bool_trait_def.hpp>
26
27 namespace boost {
28
29 namespace detail {
30
31 template <typename T>
32 struct has_trivial_copy_impl
33 {
34 #ifdef BOOST_HAS_TRIVIAL_COPY
35 #  ifdef __clang__
36    BOOST_STATIC_CONSTANT(bool, value = BOOST_HAS_TRIVIAL_COPY(T) && boost::is_copy_constructible<T>::value);
37 #  else
38    BOOST_STATIC_CONSTANT(bool, value = BOOST_HAS_TRIVIAL_COPY(T));
39 #  endif
40 #else
41    BOOST_STATIC_CONSTANT(bool, value =
42       (::boost::type_traits::ice_and<
43          ::boost::is_pod<T>::value,
44          ::boost::type_traits::ice_not< ::boost::is_volatile<T>::value >::value
45       >::value));
46 #endif
47 };
48
49 #ifdef __clang__
50
51 template <typename T, std::size_t N>
52 struct has_trivial_copy_impl<T[N]>
53 {
54    static const bool value = has_trivial_copy_impl<T>::value;
55 };
56
57 #endif
58
59 } // namespace detail
60
61 BOOST_TT_AUX_BOOL_TRAIT_DEF1(has_trivial_copy,T,::boost::detail::has_trivial_copy_impl<T>::value)
62 BOOST_TT_AUX_BOOL_TRAIT_DEF1(has_trivial_copy_constructor,T,::boost::detail::has_trivial_copy_impl<T>::value)
63
64 BOOST_TT_AUX_BOOL_TRAIT_SPEC1(has_trivial_copy,void,false)
65 #ifndef BOOST_NO_CV_VOID_SPECIALIZATIONS
66 BOOST_TT_AUX_BOOL_TRAIT_SPEC1(has_trivial_copy,void const,false)
67 BOOST_TT_AUX_BOOL_TRAIT_SPEC1(has_trivial_copy,void const volatile,false)
68 BOOST_TT_AUX_BOOL_TRAIT_SPEC1(has_trivial_copy,void volatile,false)
69 #endif
70
71 BOOST_TT_AUX_BOOL_TRAIT_SPEC1(has_trivial_copy_constructor,void,false)
72 #ifndef BOOST_NO_CV_VOID_SPECIALIZATIONS
73 BOOST_TT_AUX_BOOL_TRAIT_SPEC1(has_trivial_copy_constructor,void const,false)
74 BOOST_TT_AUX_BOOL_TRAIT_SPEC1(has_trivial_copy_constructor,void const volatile,false)
75 BOOST_TT_AUX_BOOL_TRAIT_SPEC1(has_trivial_copy_constructor,void volatile,false)
76 #endif
77
78 } // namespace boost
79
80 #include <boost/type_traits/detail/bool_trait_undef.hpp>
81
82 #endif // BOOST_TT_HAS_TRIVIAL_COPY_HPP_INCLUDED