]> git.lyx.org Git - lyx.git/blob - 3rdparty/boost/boost/type_traits/is_nothrow_move_assignable.hpp
Update to boost 1.72
[lyx.git] / 3rdparty / boost / boost / type_traits / is_nothrow_move_assignable.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_ASSIGNABLE_HPP_INCLUDED
12 #define BOOST_TT_IS_NOTHROW_MOVE_ASSIGNABLE_HPP_INCLUDED
13
14 #include <boost/config.hpp>
15 #include <boost/type_traits/has_trivial_move_assign.hpp>
16 #include <boost/type_traits/has_nothrow_assign.hpp>
17 #include <boost/type_traits/is_array.hpp>
18 #include <boost/type_traits/is_reference.hpp>
19 #include <boost/type_traits/enable_if.hpp>
20 #include <boost/type_traits/declval.hpp>
21 #include <boost/type_traits/is_complete.hpp>
22 #include <boost/static_assert.hpp>
23
24 namespace boost {
25
26 #ifdef BOOST_IS_NOTHROW_MOVE_ASSIGN
27
28 template <class T>
29 struct is_nothrow_move_assignable : public integral_constant<bool, BOOST_IS_NOTHROW_MOVE_ASSIGN(T)>
30 {
31    BOOST_STATIC_ASSERT_MSG(boost::is_complete<T>::value, "Arguments to is_nothrow_move_assignable must be complete types");
32 };
33 template <class T> struct is_nothrow_move_assignable<T const> : public false_type{};
34 template <class T> struct is_nothrow_move_assignable<T volatile> : public false_type{};
35 template <class T> struct is_nothrow_move_assignable<T const volatile> : public false_type{};
36 template <class T> struct is_nothrow_move_assignable<T&> : public false_type{};
37 #if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) 
38 template <class T> struct is_nothrow_move_assignable<T&&> : public false_type{};
39 #endif
40
41 #elif !defined(BOOST_NO_CXX11_NOEXCEPT) && !defined(BOOST_NO_SFINAE_EXPR) && !BOOST_WORKAROUND(BOOST_GCC_VERSION, < 40700)
42
43 namespace detail{
44
45 template <class T, class Enable = void>
46 struct false_or_cpp11_noexcept_move_assignable: public ::boost::false_type {};
47
48 template <class T>
49 struct false_or_cpp11_noexcept_move_assignable <
50         T,
51         typename ::boost::enable_if_<sizeof(T) && BOOST_NOEXCEPT_EXPR(::boost::declval<T&>() = ::boost::declval<T>())>::type
52     > : public ::boost::integral_constant<bool, BOOST_NOEXCEPT_EXPR(::boost::declval<T&>() = ::boost::declval<T>())>
53 {};
54
55 }
56
57 template <class T>
58 struct is_nothrow_move_assignable : public integral_constant<bool, ::boost::detail::false_or_cpp11_noexcept_move_assignable<T>::value>
59 {
60    BOOST_STATIC_ASSERT_MSG(boost::is_complete<T>::value, "Arguments to is_nothrow_move_assignable must be complete types");
61 };
62
63 template <class T> struct is_nothrow_move_assignable<T const> : public ::boost::false_type {};
64 template <class T> struct is_nothrow_move_assignable<T const volatile> : public ::boost::false_type{};
65 template <class T> struct is_nothrow_move_assignable<T volatile> : public ::boost::false_type{};
66 template <class T> struct is_nothrow_move_assignable<T&> : public ::boost::false_type{};
67 #ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
68 template <class T> struct is_nothrow_move_assignable<T&&> : public ::boost::false_type{};
69 #endif
70
71 #else
72
73 template <class T>
74 struct is_nothrow_move_assignable : public integral_constant<bool,
75    (::boost::has_trivial_move_assign<T>::value || ::boost::has_nothrow_assign<T>::value) &&  ! ::boost::is_array<T>::value>
76 {
77    BOOST_STATIC_ASSERT_MSG(boost::is_complete<T>::value, "Arguments to is_nothrow_move_assignable must be complete types");
78 };
79
80 #endif
81
82
83 template <> struct is_nothrow_move_assignable<void> : public false_type{};
84 #ifndef BOOST_NO_CV_VOID_SPECIALIZATIONS
85 template <> struct is_nothrow_move_assignable<void const> : public false_type{};
86 template <> struct is_nothrow_move_assignable<void const volatile> : public false_type{};
87 template <> struct is_nothrow_move_assignable<void volatile> : public false_type{};
88 #endif
89
90 } // namespace boost
91
92 #endif // BOOST_TT_IS_NOTHROW_MOVE_ASSIGNABLE_HPP_INCLUDED