Imported Upstream version 1.57.0
[platform/upstream/boost.git] / 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/detail/ice_and.hpp>
20 #include <boost/type_traits/detail/ice_or.hpp>
21 #include <boost/type_traits/detail/ice_not.hpp>
22 #include <boost/utility/enable_if.hpp>
23 #include <boost/utility/declval.hpp>
24
25 // should be the last #include
26 #include <boost/type_traits/detail/bool_trait_def.hpp>
27
28 namespace boost {
29
30 namespace detail{
31
32 #if !defined(BOOST_NO_CXX11_NOEXCEPT) && !defined(BOOST_NO_SFINAE_EXPR)
33
34 template <class T, class Enable = void>
35 struct false_or_cpp11_noexcept_move_assignable: public ::boost::false_type {};
36
37 template <class T>
38 struct false_or_cpp11_noexcept_move_assignable <
39         T,
40         typename ::boost::enable_if_c<sizeof(T) && BOOST_NOEXCEPT_EXPR(::boost::declval<T&>() = ::boost::declval<T>())>::type
41     > : public ::boost::integral_constant<bool, BOOST_NOEXCEPT_EXPR(::boost::declval<T&>() = ::boost::declval<T>())>
42 {};
43
44 template <class T>
45 struct is_nothrow_move_assignable_imp{
46     BOOST_STATIC_CONSTANT(bool, value = ::boost::detail::false_or_cpp11_noexcept_move_assignable<T>::value);
47 };
48
49 template <class T>
50 struct is_nothrow_move_assignable_imp<T const> : public ::boost::false_type {};
51 template <class T>
52 struct is_nothrow_move_assignable_imp<T volatile> : public ::boost::false_type{};
53 template <class T>
54 struct is_nothrow_move_assignable_imp<T const volatile> : public ::boost::false_type{};
55 template <class T>
56 struct is_nothrow_move_assignable_imp<T&> : public ::boost::false_type{};
57 #ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
58 template <class T>
59 struct is_nothrow_move_assignable_imp<T&&> : public ::boost::false_type{};
60 #endif
61
62 #else
63
64 template <class T>
65 struct is_nothrow_move_assignable_imp{
66     BOOST_STATIC_CONSTANT(bool, value = (
67         ::boost::type_traits::ice_and<
68             ::boost::type_traits::ice_or<
69                 ::boost::has_trivial_move_assign<T>::value,
70                 ::boost::has_nothrow_assign<T>::value
71             >::value,
72             ::boost::type_traits::ice_not< ::boost::is_array<T>::value >::value
73         >::value));
74 };
75
76 #endif
77
78 }
79
80 BOOST_TT_AUX_BOOL_TRAIT_DEF1(is_nothrow_move_assignable,T,::boost::detail::is_nothrow_move_assignable_imp<T>::value)
81 BOOST_TT_AUX_BOOL_TRAIT_SPEC1(is_nothrow_move_assignable,void,false)
82 #ifndef BOOST_NO_CV_VOID_SPECIALIZATIONS
83 BOOST_TT_AUX_BOOL_TRAIT_SPEC1(is_nothrow_move_assignable,void const,false)
84 BOOST_TT_AUX_BOOL_TRAIT_SPEC1(is_nothrow_move_assignable,void const volatile,false)
85 BOOST_TT_AUX_BOOL_TRAIT_SPEC1(is_nothrow_move_assignable,void volatile,false)
86 #endif
87
88 } // namespace boost
89
90 #include <boost/type_traits/detail/bool_trait_undef.hpp>
91
92 #endif // BOOST_TT_IS_NOTHROW_MOVE_ASSIGNABLE_HPP_INCLUDED