]> git.lyx.org Git - features.git/blob - 3rdparty/boost/boost/type_traits/is_nothrow_move_constructible.hpp
Rerun extract.sh to get rid of more boost
[features.git] / 3rdparty / boost / boost / type_traits / is_nothrow_move_constructible.hpp
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_IS_NOTHROW_MOVE_CONSTRUCTIBLE_HPP_INCLUDED
12 #define BOOST_TT_IS_NOTHROW_MOVE_CONSTRUCTIBLE_HPP_INCLUDED
13
14 #include <boost/config.hpp>
15 #include <boost/type_traits/intrinsics.hpp>
16 #include <boost/type_traits/integral_constant.hpp>
17 #include <boost/detail/workaround.hpp>
18
19 #ifdef BOOST_IS_NOTHROW_MOVE_CONSTRUCT
20
21 namespace boost {
22
23 template <class T>
24 struct is_nothrow_move_constructible : public integral_constant<bool, BOOST_IS_NOTHROW_MOVE_CONSTRUCT(T)>{};
25
26 template <class T> struct is_nothrow_move_constructible<volatile T> : public ::boost::false_type {};
27 template <class T> struct is_nothrow_move_constructible<const volatile T> : public ::boost::false_type{};
28
29 #elif !defined(BOOST_NO_CXX11_NOEXCEPT) && !defined(BOOST_NO_SFINAE_EXPR) && !BOOST_WORKAROUND(BOOST_GCC_VERSION, < 40800)
30
31 #include <boost/type_traits/declval.hpp>
32 #include <boost/utility/enable_if.hpp>
33
34 namespace boost{ namespace detail{
35
36 template <class T, class Enable = void>
37 struct false_or_cpp11_noexcept_move_constructible: public ::boost::false_type {};
38
39 template <class T>
40 struct false_or_cpp11_noexcept_move_constructible <
41         T,
42         typename ::boost::enable_if_c<sizeof(T) && BOOST_NOEXCEPT_EXPR(T(::boost::declval<T>()))>::type
43     > : public ::boost::integral_constant<bool, BOOST_NOEXCEPT_EXPR(T(::boost::declval<T>()))>
44 {};
45
46 }
47
48 template <class T> struct is_nothrow_move_constructible
49    : public integral_constant<bool, ::boost::detail::false_or_cpp11_noexcept_move_constructible<T>::value>{};
50
51 template <class T> struct is_nothrow_move_constructible<volatile T> : public ::boost::false_type {};
52 template <class T> struct is_nothrow_move_constructible<const volatile T> : public ::boost::false_type{};
53 template <class T, std::size_t N> struct is_nothrow_move_constructible<T[N]> : public ::boost::false_type{};
54 template <class T> struct is_nothrow_move_constructible<T[]> : public ::boost::false_type{};
55
56 #else
57
58 #include <boost/type_traits/has_trivial_move_constructor.hpp>
59 #include <boost/type_traits/has_nothrow_copy.hpp>
60 #include <boost/type_traits/is_array.hpp>
61
62 namespace boost{
63
64 template <class T>
65 struct is_nothrow_move_constructible
66    : public integral_constant<bool,
67    (::boost::has_trivial_move_constructor<T>::value || ::boost::has_nothrow_copy<T>::value) && !::boost::is_array<T>::value>
68 {};
69
70 #endif
71
72 template <> struct is_nothrow_move_constructible<void> : false_type{};
73 #ifndef BOOST_NO_CV_VOID_SPECIALIZATIONS
74 template <> struct is_nothrow_move_constructible<void const> : false_type{};
75 template <> struct is_nothrow_move_constructible<void volatile> : false_type{};
76 template <> struct is_nothrow_move_constructible<void const volatile> : false_type{};
77 #endif
78 // References are always trivially constructible, even if the thing they reference is not:
79 template <class T> struct is_nothrow_move_constructible<T&> : public ::boost::true_type{};
80 #ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
81 template <class T> struct is_nothrow_move_constructible<T&&> : public ::boost::true_type{};
82 #endif
83
84 } // namespace boost
85
86 #endif // BOOST_TT_IS_NOTHROW_MOVE_CONSTRUCTIBLE_HPP_INCLUDED