1 | |
2 | // (C) Copyright Steve Cleary, Beman Dawes, Howard Hinnant & John Maddock 2000. |
3 | // (C) Copyright Eric Friedman 2002-2003. |
4 | // (C) Copyright Antony Polukhin 2013. |
5 | // Use, modification and distribution are subject to the Boost Software License, |
6 | // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at |
7 | // http://www.boost.org/LICENSE_1_0.txt). |
8 | // |
9 | // See http://www.boost.org/libs/type_traits for most recent version including documentation. |
10 | |
11 | #ifndef BOOST_TT_HAS_TRIVIAL_MOVE_CONSTRUCTOR_HPP_INCLUDED |
12 | #define BOOST_TT_HAS_TRIVIAL_MOVE_CONSTRUCTOR_HPP_INCLUDED |
13 | |
14 | #include <cstddef> // size_t |
15 | #include <boost/type_traits/intrinsics.hpp> |
16 | #include <boost/type_traits/integral_constant.hpp> |
17 | |
18 | #ifdef BOOST_HAS_TRIVIAL_MOVE_CONSTRUCTOR |
19 | |
20 | #if defined(BOOST_MSVC) || defined(BOOST_INTEL) |
21 | #include <boost/type_traits/is_pod.hpp> |
22 | #include <boost/type_traits/is_volatile.hpp> |
23 | #endif |
24 | |
25 | #if defined(__GNUC__) || defined(__clang) |
26 | #include <boost/type_traits/is_constructible.hpp> |
27 | #include <boost/type_traits/is_volatile.hpp> |
28 | #endif |
29 | |
30 | |
31 | namespace boost { |
32 | |
33 | template <typename T> struct has_trivial_move_constructor : public integral_constant<bool, BOOST_HAS_TRIVIAL_MOVE_CONSTRUCTOR(T)>{}; |
34 | |
35 | #else |
36 | |
37 | #ifdef __SUNPRO_CC |
38 | #include <boost/type_traits/is_constructible.hpp> |
39 | #include <boost/type_traits/remove_const.hpp> |
40 | #if __cplusplus >= 201103 |
41 | #define SOLARIS_EXTRA_CHECK && is_constructible<typename remove_const<T>::type, typename remove_const<T>::type&&>::value |
42 | #endif |
43 | #endif |
44 | |
45 | #ifndef SOLARIS_EXTRA_CHECK |
46 | #define |
47 | #endif |
48 | |
49 | #include <boost/type_traits/is_pod.hpp> |
50 | #include <boost/type_traits/is_volatile.hpp> |
51 | |
52 | namespace boost { |
53 | |
54 | template <typename T> struct has_trivial_move_constructor |
55 | : public integral_constant<bool, ::boost::is_pod<T>::value && !::boost::is_volatile<T>::value SOLARIS_EXTRA_CHECK>{}; |
56 | |
57 | #undef SOLARIS_EXTRA_CHECK |
58 | |
59 | #endif |
60 | |
61 | template <> struct has_trivial_move_constructor<void> : public false_type{}; |
62 | #ifndef BOOST_NO_CV_VOID_SPECIALIZATIONS |
63 | template <> struct has_trivial_move_constructor<void const> : public false_type{}; |
64 | template <> struct has_trivial_move_constructor<void volatile> : public false_type{}; |
65 | template <> struct has_trivial_move_constructor<void const volatile> : public false_type{}; |
66 | #endif |
67 | // What should we do with reference types??? The standard seems to suggest these are trivial, even if the thing they reference is not: |
68 | template <class T> struct has_trivial_move_constructor<T&> : public true_type{}; |
69 | #ifndef BOOST_NO_CXX11_RVALUE_REFERENCES |
70 | template <class T> struct has_trivial_move_constructor<T&&> : public true_type{}; |
71 | #endif |
72 | // Arrays can not be explicitly copied: |
73 | template <class T, std::size_t N> struct has_trivial_move_constructor<T[N]> : public false_type{}; |
74 | template <class T> struct has_trivial_move_constructor<T[]> : public false_type{}; |
75 | |
76 | } // namespace boost |
77 | |
78 | #endif // BOOST_TT_HAS_TRIVIAL_MOVE_CONSTRUCTOR_HPP_INCLUDED |
79 | |