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/intrinsics.hpp>
13#include <boost/type_traits/is_pod.hpp>
14#include <boost/type_traits/is_reference.hpp>
15
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
19#else
20#define BOOST_TT_TRIVIAL_CONSTRUCT_FIX
21#endif
22
23#ifdef BOOST_INTEL
24#include <boost/type_traits/add_const.hpp>
25#include <boost/type_traits/add_lvalue_reference.hpp>
26#endif
27
28namespace boost {
29
30template <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
34#else
35 ::boost::is_pod<T>::value
36#endif
37>{};
38// Arrays are not explicitly copyable:
39template <typename T, std::size_t N> struct has_trivial_copy<T[N]> : public false_type{};
40template <typename T> struct has_trivial_copy<T[]> : public false_type{};
41// Are volatile types ever trivial? We don't really know, so assume not:
42template <typename T> struct has_trivial_copy<T volatile> : public false_type{};
43
44template <> struct has_trivial_copy<void> : public false_type{};
45#ifndef BOOST_NO_CV_VOID_SPECIALIZATIONS
46template <> struct has_trivial_copy<void const> : public false_type{};
47template <> struct has_trivial_copy<void volatile> : public false_type{};
48template <> struct has_trivial_copy<void const volatile> : public false_type{};
49#endif
50
51template <class T> struct has_trivial_copy<T&> : public false_type{};
52#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
53template <class T> struct has_trivial_copy<T&&> : public false_type{};
54#endif
55
56template <class T> struct has_trivial_copy_constructor : public has_trivial_copy<T>{};
57
58#undef BOOST_TT_TRIVIAL_CONSTRUCT_FIX
59
60} // namespace boost
61
62#endif // BOOST_TT_HAS_TRIVIAL_COPY_HPP_INCLUDED
63