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
22namespace boost {
23
24#ifdef BOOST_IS_NOTHROW_MOVE_ASSIGN
25
26template <class T>
27struct is_nothrow_move_assignable : public integral_constant<bool, BOOST_IS_NOTHROW_MOVE_ASSIGN(T)>{};
28template <class T> struct is_nothrow_move_assignable<T const> : public false_type{};
29template <class T> struct is_nothrow_move_assignable<T volatile> : public false_type{};
30template <class T> struct is_nothrow_move_assignable<T const volatile> : public false_type{};
31template <class T> struct is_nothrow_move_assignable<T&> : public false_type{};
32#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
33template <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)
37
38namespace detail{
39
40template <class T, class Enable = void>
41struct false_or_cpp11_noexcept_move_assignable: public ::boost::false_type {};
42
43template <class T>
44struct 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
52template <class T>
53struct is_nothrow_move_assignable : public integral_constant<bool, ::boost::detail::false_or_cpp11_noexcept_move_assignable<T>::value>{};
54
55template <class T> struct is_nothrow_move_assignable<T const> : public ::boost::false_type {};
56template <class T> struct is_nothrow_move_assignable<T const volatile> : public ::boost::false_type{};
57template <class T> struct is_nothrow_move_assignable<T volatile> : public ::boost::false_type{};
58template <class T> struct is_nothrow_move_assignable<T&> : public ::boost::false_type{};
59#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
60template <class T> struct is_nothrow_move_assignable<T&&> : public ::boost::false_type{};
61#endif
62
63#else
64
65template <class T>
66struct 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
72template <> struct is_nothrow_move_assignable<void> : public false_type{};
73#ifndef BOOST_NO_CV_VOID_SPECIALIZATIONS
74template <> struct is_nothrow_move_assignable<void const> : public false_type{};
75template <> struct is_nothrow_move_assignable<void const volatile> : public false_type{};
76template <> 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
82

source code of boost/boost/type_traits/is_nothrow_move_assignable.hpp