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).
9 // See http://www.boost.org/libs/type_traits for most recent version including documentation.
11 #ifndef BOOST_TT_HAS_TRIVIAL_MOVE_CONSTRUCTOR_HPP_INCLUDED
12 #define BOOST_TT_HAS_TRIVIAL_MOVE_CONSTRUCTOR_HPP_INCLUDED
14 #include <cstddef> // size_t
15 #include <boost/type_traits/intrinsics.hpp>
16 #include <boost/type_traits/integral_constant.hpp>
18 #ifdef BOOST_HAS_TRIVIAL_MOVE_CONSTRUCTOR
20 #if defined(BOOST_MSVC) || defined(BOOST_INTEL)
21 #include <boost/type_traits/is_pod.hpp>
22 #include <boost/type_traits/is_volatile.hpp>
25 #if defined(__GNUC__) || defined(__clang)
26 #include <boost/type_traits/is_constructible.hpp>
27 #include <boost/type_traits/is_volatile.hpp>
33 template <typename T> struct has_trivial_move_constructor : public integral_constant<bool, BOOST_HAS_TRIVIAL_MOVE_CONSTRUCTOR(T)>{};
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
45 #ifndef SOLARIS_EXTRA_CHECK
46 #define SOLARIS_EXTRA_CHECK
49 #include <boost/type_traits/is_pod.hpp>
50 #include <boost/type_traits/is_volatile.hpp>
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>{};
57 #undef SOLARIS_EXTRA_CHECK
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{};
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{};
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{};
78 #endif // BOOST_TT_HAS_TRIVIAL_MOVE_CONSTRUCTOR_HPP_INCLUDED