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_IS_NOTHROW_MOVE_ASSIGNABLE_HPP_INCLUDED
12 #define BOOST_TT_IS_NOTHROW_MOVE_ASSIGNABLE_HPP_INCLUDED
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>
26 #ifdef BOOST_IS_NOTHROW_MOVE_ASSIGN
29 struct is_nothrow_move_assignable : public integral_constant<bool, BOOST_IS_NOTHROW_MOVE_ASSIGN(T)>
31 BOOST_STATIC_ASSERT_MSG(boost::is_complete<T>::value, "Arguments to is_nothrow_move_assignable must be complete types");
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{};
41 #elif !defined(BOOST_NO_CXX11_NOEXCEPT) && !defined(BOOST_NO_SFINAE_EXPR) && !BOOST_WORKAROUND(BOOST_GCC_VERSION, < 40700)
45 template <class T, class Enable = void>
46 struct false_or_cpp11_noexcept_move_assignable: public ::boost::false_type {};
49 struct false_or_cpp11_noexcept_move_assignable <
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>())>
58 struct is_nothrow_move_assignable : public integral_constant<bool, ::boost::detail::false_or_cpp11_noexcept_move_assignable<T>::value>
60 BOOST_STATIC_ASSERT_MSG(boost::is_complete<T>::value, "Arguments to is_nothrow_move_assignable must be complete types");
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{};
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>
77 BOOST_STATIC_ASSERT_MSG(boost::is_complete<T>::value, "Arguments to is_nothrow_move_assignable must be complete types");
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{};
92 #endif // BOOST_TT_IS_NOTHROW_MOVE_ASSIGNABLE_HPP_INCLUDED