]>
Commit | Line | Data |
---|---|---|
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/utility/enable_if.hpp> | |
20 | #include <boost/type_traits/declval.hpp> | |
21 | ||
22 | namespace boost { | |
23 | ||
24 | #ifdef BOOST_IS_NOTHROW_MOVE_ASSIGN | |
25 | ||
26 | template <class T> | |
27 | struct is_nothrow_move_assignable : public integral_constant<bool, BOOST_IS_NOTHROW_MOVE_ASSIGN(T)>{}; | |
28 | template <class T> struct is_nothrow_move_assignable<T const> : public false_type{}; | |
29 | template <class T> struct is_nothrow_move_assignable<T volatile> : public false_type{}; | |
30 | template <class T> struct is_nothrow_move_assignable<T const volatile> : public false_type{}; | |
31 | template <class T> struct is_nothrow_move_assignable<T&> : public false_type{}; | |
32 | #if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) | |
33 | template <class T> struct is_nothrow_move_assignable<T&&> : public false_type{}; | |
34 | #endif | |
35 | ||
36 | #elif !defined(BOOST_NO_CXX11_NOEXCEPT) && !defined(BOOST_NO_SFINAE_EXPR) && !BOOST_WORKAROUND(BOOST_GCC_VERSION, < 40700) | |
37 | ||
38 | namespace detail{ | |
39 | ||
40 | template <class T, class Enable = void> | |
41 | struct false_or_cpp11_noexcept_move_assignable: public ::boost::false_type {}; | |
42 | ||
43 | template <class T> | |
44 | struct false_or_cpp11_noexcept_move_assignable < | |
45 | T, | |
46 | typename ::boost::enable_if_c<sizeof(T) && BOOST_NOEXCEPT_EXPR(::boost::declval<T&>() = ::boost::declval<T>())>::type | |
47 | > : public ::boost::integral_constant<bool, BOOST_NOEXCEPT_EXPR(::boost::declval<T&>() = ::boost::declval<T>())> | |
48 | {}; | |
49 | ||
50 | } | |
51 | ||
52 | template <class T> | |
53 | struct is_nothrow_move_assignable : public integral_constant<bool, ::boost::detail::false_or_cpp11_noexcept_move_assignable<T>::value>{}; | |
54 | ||
55 | template <class T> struct is_nothrow_move_assignable<T const> : public ::boost::false_type {}; | |
56 | template <class T> struct is_nothrow_move_assignable<T const volatile> : public ::boost::false_type{}; | |
57 | template <class T> struct is_nothrow_move_assignable<T volatile> : public ::boost::false_type{}; | |
58 | template <class T> struct is_nothrow_move_assignable<T&> : public ::boost::false_type{}; | |
59 | #ifndef BOOST_NO_CXX11_RVALUE_REFERENCES | |
60 | template <class T> struct is_nothrow_move_assignable<T&&> : public ::boost::false_type{}; | |
61 | #endif | |
62 | ||
63 | #else | |
64 | ||
65 | template <class T> | |
66 | struct is_nothrow_move_assignable : public integral_constant<bool, | |
67 | (::boost::has_trivial_move_assign<T>::value || ::boost::has_nothrow_assign<T>::value) && ! ::boost::is_array<T>::value>{}; | |
68 | ||
69 | #endif | |
70 | ||
71 | ||
72 | template <> struct is_nothrow_move_assignable<void> : public false_type{}; | |
73 | #ifndef BOOST_NO_CV_VOID_SPECIALIZATIONS | |
74 | template <> struct is_nothrow_move_assignable<void const> : public false_type{}; | |
75 | template <> struct is_nothrow_move_assignable<void const volatile> : public false_type{}; | |
76 | template <> struct is_nothrow_move_assignable<void volatile> : public false_type{}; | |
77 | #endif | |
78 | ||
79 | } // namespace boost | |
80 | ||
81 | #endif // BOOST_TT_IS_NOTHROW_MOVE_ASSIGNABLE_HPP_INCLUDED |