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_HAS_TRIVIAL_COPY_HPP_INCLUDED
10 #define BOOST_TT_HAS_TRIVIAL_COPY_HPP_INCLUDED
12 #include <boost/type_traits/intrinsics.hpp>
13 #include <boost/type_traits/is_pod.hpp>
14 #include <boost/type_traits/is_reference.hpp>
16 #if (defined(__GNUC__) && (__GNUC__ * 100 + __GNUC_MINOR__ >= 409)) || defined(BOOST_CLANG) || (defined(__SUNPRO_CC) && defined(BOOST_HAS_TRIVIAL_COPY))
17 #include <boost/type_traits/is_copy_constructible.hpp>
18 #define BOOST_TT_TRIVIAL_CONSTRUCT_FIX && is_copy_constructible<T>::value
20 #define BOOST_TT_TRIVIAL_CONSTRUCT_FIX
24 #include <boost/type_traits/add_const.hpp>
25 #include <boost/type_traits/add_lvalue_reference.hpp>
30 template <typename T> struct has_trivial_copy
31 : public integral_constant<bool,
32 #ifdef BOOST_HAS_TRIVIAL_COPY
33 BOOST_HAS_TRIVIAL_COPY(T) BOOST_TT_TRIVIAL_CONSTRUCT_FIX
35 ::boost::is_pod<T>::value
38 // Arrays are not explicitly copyable:
39 template <typename T, std::size_t N> struct has_trivial_copy<T[N]> : public false_type{};
40 template <typename T> struct has_trivial_copy<T[]> : public false_type{};
41 // Are volatile types ever trivial? We don't really know, so assume not:
42 template <typename T> struct has_trivial_copy<T volatile> : public false_type{};
44 template <> struct has_trivial_copy<void> : public false_type{};
45 #ifndef BOOST_NO_CV_VOID_SPECIALIZATIONS
46 template <> struct has_trivial_copy<void const> : public false_type{};
47 template <> struct has_trivial_copy<void volatile> : public false_type{};
48 template <> struct has_trivial_copy<void const volatile> : public false_type{};
51 template <class T> struct has_trivial_copy<T&> : public false_type{};
52 #if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
53 template <class T> struct has_trivial_copy<T&&> : public false_type{};
56 template <class T> struct has_trivial_copy_constructor : public has_trivial_copy<T>{};
58 #undef BOOST_TT_TRIVIAL_CONSTRUCT_FIX
62 #endif // BOOST_TT_HAS_TRIVIAL_COPY_HPP_INCLUDED