| 1 | |
|---|
| 2 | // (C) Copyright Eric Friedman 2002-2003. |
|---|
| 3 | // Distributed under the Boost Software License, Version 1.0. (See |
|---|
| 4 | // accompanying file LICENSE_1_0.txt or copy at |
|---|
| 5 | // http://www.boost.org/LICENSE_1_0.txt) |
|---|
| 6 | // |
|---|
| 7 | // See http://www.boost.org for most recent version including documentation. |
|---|
| 8 | |
|---|
| 9 | #ifndef BOOST_VARIANT_DETAIL_HAS_NOTHROW_MOVE_HPP_INCLUDED |
|---|
| 10 | #define BOOST_VARIANT_DETAIL_HAS_NOTHROW_MOVE_HPP_INCLUDED |
|---|
| 11 | |
|---|
| 12 | #include "boost/config.hpp" // for STATIC_CONSTANT |
|---|
| 13 | #include "boost/variant/detail/has_trivial_move.hpp" |
|---|
| 14 | #include "boost/type_traits/has_nothrow_copy.hpp" |
|---|
| 15 | #include "boost/type_traits/has_nothrow_assign.hpp" |
|---|
| 16 | |
|---|
| 17 | #include "boost/mpl/and.hpp" |
|---|
| 18 | #include "boost/mpl/or.hpp" |
|---|
| 19 | |
|---|
| 20 | // should be the last #include |
|---|
| 21 | #include "boost/variant/detail/bool_trait_def.hpp" |
|---|
| 22 | |
|---|
| 23 | namespace boost { |
|---|
| 24 | namespace detail { namespace variant { |
|---|
| 25 | |
|---|
| 26 | // TRAIT: has_nothrow_move |
|---|
| 27 | |
|---|
| 28 | template <typename T> |
|---|
| 29 | struct has_nothrow_move_impl |
|---|
| 30 | { |
|---|
| 31 | BOOST_STATIC_CONSTANT( |
|---|
| 32 | bool, value = ( |
|---|
| 33 | ::boost::mpl::or_< |
|---|
| 34 | has_trivial_move<T> |
|---|
| 35 | , ::boost::mpl::and_< |
|---|
| 36 | has_nothrow_copy<T> |
|---|
| 37 | , has_nothrow_assign<T> |
|---|
| 38 | > |
|---|
| 39 | >::type::value |
|---|
| 40 | ) |
|---|
| 41 | ); |
|---|
| 42 | }; |
|---|
| 43 | |
|---|
| 44 | BOOST_VARIANT_TT_AUX_BOOL_TRAIT_DEF1( |
|---|
| 45 | has_nothrow_move |
|---|
| 46 | , T |
|---|
| 47 | , (::boost::detail::variant::has_nothrow_move_impl<T>::value) |
|---|
| 48 | ) |
|---|
| 49 | |
|---|
| 50 | |
|---|
| 51 | // TRAIT: has_nothrow_move_constructor |
|---|
| 52 | |
|---|
| 53 | template <typename T> |
|---|
| 54 | struct has_nothrow_move_constructor_impl |
|---|
| 55 | { |
|---|
| 56 | BOOST_STATIC_CONSTANT( |
|---|
| 57 | bool, value = ( |
|---|
| 58 | ::boost::mpl::or_< |
|---|
| 59 | has_nothrow_move<T> |
|---|
| 60 | , has_trivial_move_constructor<T> |
|---|
| 61 | , has_nothrow_copy<T> |
|---|
| 62 | >::type::value |
|---|
| 63 | ) |
|---|
| 64 | ); |
|---|
| 65 | }; |
|---|
| 66 | |
|---|
| 67 | BOOST_VARIANT_TT_AUX_BOOL_TRAIT_DEF1( |
|---|
| 68 | has_nothrow_move_constructor |
|---|
| 69 | , T |
|---|
| 70 | , (::boost::detail::variant::has_nothrow_move_constructor_impl<T>::value) |
|---|
| 71 | ) |
|---|
| 72 | |
|---|
| 73 | |
|---|
| 74 | // TRAIT: has_nothrow_move_assign |
|---|
| 75 | |
|---|
| 76 | template <typename T> |
|---|
| 77 | struct has_nothrow_move_assign_impl |
|---|
| 78 | { |
|---|
| 79 | BOOST_STATIC_CONSTANT( |
|---|
| 80 | bool, value = ( |
|---|
| 81 | ::boost::mpl::or_< |
|---|
| 82 | has_nothrow_move<T> |
|---|
| 83 | , has_trivial_move_assign<T> |
|---|
| 84 | , has_nothrow_assign<T> |
|---|
| 85 | >::type::value |
|---|
| 86 | ) |
|---|
| 87 | ); |
|---|
| 88 | }; |
|---|
| 89 | |
|---|
| 90 | BOOST_VARIANT_TT_AUX_BOOL_TRAIT_DEF1( |
|---|
| 91 | has_nothrow_move_assign |
|---|
| 92 | , T |
|---|
| 93 | , (::boost::detail::variant::has_nothrow_move_assign_impl<T>::value) |
|---|
| 94 | ) |
|---|
| 95 | |
|---|
| 96 | }} // namespace detail::variant |
|---|
| 97 | |
|---|
| 98 | BOOST_VARIANT_TT_AUX_TRAIT_SUFFIX(1,::boost::detail::variant::has_nothrow_move) |
|---|
| 99 | BOOST_VARIANT_TT_AUX_TRAIT_SUFFIX(1,::boost::detail::variant::has_nothrow_move_constructor) |
|---|
| 100 | BOOST_VARIANT_TT_AUX_TRAIT_SUFFIX(1,::boost::detail::variant::has_nothrow_move_assign) |
|---|
| 101 | |
|---|
| 102 | } // namespace boost |
|---|
| 103 | |
|---|
| 104 | #include "boost/variant/detail/bool_trait_undef.hpp" |
|---|
| 105 | |
|---|
| 106 | #endif // BOOST_VARIANT_DETAIL_HAS_NOTHROW_MOVE_HPP_INCLUDED |
|---|