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 <boost/type_traits/intrinsics.hpp>
15#include <boost/type_traits/integral_constant.hpp>
16
17#ifdef BOOST_HAS_TRIVIAL_MOVE_CONSTRUCTOR
18
19#if defined(BOOST_MSVC) || defined(BOOST_INTEL)
20#include <boost/type_traits/is_pod.hpp>
21#include <boost/type_traits/is_volatile.hpp>
22#endif
23
24#if defined(__GNUC__) || defined(__clang)
25#include <boost/type_traits/is_constructible.hpp>
26#include <boost/type_traits/is_volatile.hpp>
27#endif
28
29
30namespace boost {
31
32template <typename T> struct has_trivial_move_constructor : public integral_constant<bool, BOOST_HAS_TRIVIAL_MOVE_CONSTRUCTOR(T)>{};
33
34#else
35
36#ifdef __SUNPRO_CC
37#include <boost/type_traits/is_constructible.hpp>
38#include <boost/type_traits/remove_const.hpp>
39#if __cplusplus >= 201103
40#define SOLARIS_EXTRA_CHECK && is_constructible<typename remove_const<T>::type, typename remove_const<T>::type&&>::value
41#endif
42#endif
43
44#ifndef SOLARIS_EXTRA_CHECK
45#define SOLARIS_EXTRA_CHECK
46#endif
47
48#include <boost/type_traits/is_pod.hpp>
49#include <boost/type_traits/is_volatile.hpp>
50
51namespace boost {
52
53template <typename T> struct has_trivial_move_constructor
54 : public integral_constant<bool, ::boost::is_pod<T>::value && !::boost::is_volatile<T>::value SOLARIS_EXTRA_CHECK>{};
55
56#undef SOLARIS_EXTRA_CHECK
57
58#endif
59
60template <> struct has_trivial_move_constructor<void> : public false_type{};
61#ifndef BOOST_NO_CV_VOID_SPECIALIZATIONS
62template <> struct has_trivial_move_constructor<void const> : public false_type{};
63template <> struct has_trivial_move_constructor<void volatile> : public false_type{};
64template <> struct has_trivial_move_constructor<void const volatile> : public false_type{};
65#endif
66// What should we do with reference types??? The standard seems to suggest these are trivial, even if the thing they reference is not:
67template <class T> struct has_trivial_move_constructor<T&> : public true_type{};
68#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
69template <class T> struct has_trivial_move_constructor<T&&> : public true_type{};
70#endif
71// Arrays can not be explicitly copied:
72template <class T, std::size_t N> struct has_trivial_move_constructor<T[N]> : public false_type{};
73template <class T> struct has_trivial_move_constructor<T[]> : public false_type{};
74
75} // namespace boost
76
77#endif // BOOST_TT_HAS_TRIVIAL_MOVE_CONSTRUCTOR_HPP_INCLUDED
78