annotate DEPENDENCIES/generic/include/boost/move/detail/move_helpers.hpp @ 16:2665513ce2d3

Add boost headers
author Chris Cannam
date Tue, 05 Aug 2014 11:11:38 +0100
parents
children c530137014c0
rev   line source
Chris@16 1 //////////////////////////////////////////////////////////////////////////////
Chris@16 2 //
Chris@16 3 // (C) Copyright Ion Gaztanaga 2010-2012.
Chris@16 4 // Distributed under the Boost Software License, Version 1.0.
Chris@16 5 // (See accompanying file LICENSE_1_0.txt or copy at
Chris@16 6 // http://www.boost.org/LICENSE_1_0.txt)
Chris@16 7 //
Chris@16 8 // See http://www.boost.org/libs/move for documentation.
Chris@16 9 //
Chris@16 10 //////////////////////////////////////////////////////////////////////////////
Chris@16 11
Chris@16 12 #ifndef BOOST_MOVE_MOVE_HELPERS_HPP
Chris@16 13 #define BOOST_MOVE_MOVE_HELPERS_HPP
Chris@16 14
Chris@16 15 #include <boost/move/utility.hpp>
Chris@16 16 #include <boost/type_traits/is_class.hpp>
Chris@16 17 #include <boost/move/utility.hpp>
Chris@16 18 #include <boost/move/traits.hpp>
Chris@16 19
Chris@16 20 #if defined(BOOST_NO_CXX11_RVALUE_REFERENCES) || (defined(_MSC_VER) && (_MSC_VER == 1600))
Chris@16 21 #include <boost/type_traits/is_same.hpp>
Chris@16 22 #include <boost/type_traits/is_class.hpp>
Chris@16 23 #include <boost/type_traits/is_convertible.hpp>
Chris@16 24 #include <boost/utility/enable_if.hpp>
Chris@16 25 #endif
Chris@16 26 #if defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
Chris@16 27 #include <boost/mpl/if.hpp>
Chris@16 28 #endif
Chris@16 29
Chris@16 30
Chris@16 31 #if defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
Chris@16 32 struct not_a_type;
Chris@16 33 struct not_a_type2;
Chris@16 34 #define BOOST_MOVE_CATCH_CONST(U) \
Chris@16 35 typename ::boost::mpl::if_< ::boost::is_class<U>, BOOST_CATCH_CONST_RLVALUE(U), const U &>::type
Chris@16 36 #define BOOST_MOVE_CATCH_RVALUE(U)\
Chris@16 37 typename ::boost::mpl::if_< ::boost::is_class<U>, BOOST_RV_REF(U), not_a_type>::type
Chris@16 38 #define BOOST_MOVE_CATCH_FWD(U) BOOST_FWD_REF(U)
Chris@16 39 #else
Chris@16 40 #define BOOST_MOVE_CATCH_CONST(U) const U &
Chris@16 41 #define BOOST_MOVE_CATCH_RVALUE(U) U &&
Chris@16 42 #define BOOST_MOVE_CATCH_FWD(U) U &&
Chris@16 43 #endif
Chris@16 44
Chris@16 45 #ifdef BOOST_NO_CXX11_RVALUE_REFERENCES
Chris@16 46 #define BOOST_MOVE_CONVERSION_AWARE_CATCH(PUB_FUNCTION, TYPE, RETURN_VALUE, FWD_FUNCTION)\
Chris@16 47 RETURN_VALUE PUB_FUNCTION(BOOST_MOVE_CATCH_CONST(TYPE) x)\
Chris@16 48 { return FWD_FUNCTION(static_cast<const TYPE&>(x)); }\
Chris@16 49 \
Chris@16 50 RETURN_VALUE PUB_FUNCTION(BOOST_MOVE_CATCH_RVALUE(TYPE) x) \
Chris@16 51 { return FWD_FUNCTION(::boost::move(x)); }\
Chris@16 52 \
Chris@16 53 RETURN_VALUE PUB_FUNCTION(TYPE &x)\
Chris@16 54 { return FWD_FUNCTION(const_cast<const TYPE &>(x)); }\
Chris@16 55 \
Chris@16 56 template<class BOOST_MOVE_TEMPL_PARAM>\
Chris@16 57 typename ::boost::enable_if_c\
Chris@16 58 < ::boost::is_class<TYPE>::value &&\
Chris@16 59 ::boost::is_same<TYPE, BOOST_MOVE_TEMPL_PARAM>::value &&\
Chris@16 60 !::boost::has_move_emulation_enabled<BOOST_MOVE_TEMPL_PARAM>::value\
Chris@16 61 , RETURN_VALUE >::type\
Chris@16 62 PUB_FUNCTION(const BOOST_MOVE_TEMPL_PARAM &u)\
Chris@16 63 { return FWD_FUNCTION(u); }\
Chris@16 64 \
Chris@16 65 template<class BOOST_MOVE_TEMPL_PARAM>\
Chris@16 66 typename ::boost::enable_if_c\
Chris@16 67 < (!::boost::is_class<BOOST_MOVE_TEMPL_PARAM>::value || \
Chris@16 68 !::boost::move_detail::is_rv<BOOST_MOVE_TEMPL_PARAM>::value) && \
Chris@16 69 !::boost::is_same<TYPE, BOOST_MOVE_TEMPL_PARAM>::value \
Chris@16 70 , RETURN_VALUE >::type\
Chris@16 71 PUB_FUNCTION(const BOOST_MOVE_TEMPL_PARAM &u)\
Chris@16 72 {\
Chris@16 73 TYPE t(u);\
Chris@16 74 return FWD_FUNCTION(::boost::move(t));\
Chris@16 75 }\
Chris@16 76 //
Chris@16 77 // ::boost::is_convertible<BOOST_MOVE_TEMPL_PARAM, TYPE>::value &&
Chris@16 78 #elif (defined(_MSC_VER) && (_MSC_VER == 1600))
Chris@16 79
Chris@16 80 #define BOOST_MOVE_CONVERSION_AWARE_CATCH(PUB_FUNCTION, TYPE, RETURN_VALUE, FWD_FUNCTION)\
Chris@16 81 RETURN_VALUE PUB_FUNCTION(BOOST_MOVE_CATCH_CONST(TYPE) x)\
Chris@16 82 { return FWD_FUNCTION(static_cast<const TYPE&>(x)); }\
Chris@16 83 \
Chris@16 84 RETURN_VALUE PUB_FUNCTION(BOOST_MOVE_CATCH_RVALUE(TYPE) x) \
Chris@16 85 { return FWD_FUNCTION(::boost::move(x)); }\
Chris@16 86 \
Chris@16 87 template<class BOOST_MOVE_TEMPL_PARAM>\
Chris@16 88 typename ::boost::enable_if_c\
Chris@16 89 < !::boost::is_same<TYPE, BOOST_MOVE_TEMPL_PARAM>::value\
Chris@16 90 , RETURN_VALUE >::type\
Chris@16 91 PUB_FUNCTION(const BOOST_MOVE_TEMPL_PARAM &u)\
Chris@16 92 {\
Chris@16 93 TYPE t(u);\
Chris@16 94 return FWD_FUNCTION(::boost::move(t));\
Chris@16 95 }\
Chris@16 96 //
Chris@16 97
Chris@16 98 #else
Chris@16 99
Chris@16 100 #define BOOST_MOVE_CONVERSION_AWARE_CATCH(PUB_FUNCTION, TYPE, RETURN_VALUE, FWD_FUNCTION)\
Chris@16 101 RETURN_VALUE PUB_FUNCTION(BOOST_MOVE_CATCH_CONST(TYPE) x)\
Chris@16 102 { return FWD_FUNCTION(static_cast<const TYPE&>(x)); }\
Chris@16 103 \
Chris@16 104 RETURN_VALUE PUB_FUNCTION(BOOST_MOVE_CATCH_RVALUE(TYPE) x) \
Chris@16 105 { return FWD_FUNCTION(::boost::move(x)); }\
Chris@16 106 //
Chris@16 107
Chris@16 108 #endif
Chris@16 109
Chris@16 110
Chris@16 111 #ifdef BOOST_NO_CXX11_RVALUE_REFERENCES
Chris@16 112
Chris@16 113 #define BOOST_MOVE_CONVERSION_AWARE_CATCH_1ARG(PUB_FUNCTION, TYPE, RETURN_VALUE, FWD_FUNCTION, ARG1, UNLESS_CONVERTIBLE_TO)\
Chris@16 114 RETURN_VALUE PUB_FUNCTION(ARG1 arg1, BOOST_MOVE_CATCH_CONST(TYPE) x)\
Chris@16 115 { return FWD_FUNCTION(arg1, static_cast<const TYPE&>(x)); }\
Chris@16 116 \
Chris@16 117 RETURN_VALUE PUB_FUNCTION(ARG1 arg1, BOOST_MOVE_CATCH_RVALUE(TYPE) x) \
Chris@16 118 { return FWD_FUNCTION(arg1, ::boost::move(x)); }\
Chris@16 119 \
Chris@16 120 RETURN_VALUE PUB_FUNCTION(ARG1 arg1, TYPE &x)\
Chris@16 121 { return FWD_FUNCTION(arg1, const_cast<const TYPE &>(x)); }\
Chris@16 122 \
Chris@16 123 template<class BOOST_MOVE_TEMPL_PARAM>\
Chris@16 124 typename ::boost::enable_if_c<\
Chris@16 125 ::boost::is_same<TYPE, BOOST_MOVE_TEMPL_PARAM>::value &&\
Chris@16 126 !::boost::has_move_emulation_enabled<BOOST_MOVE_TEMPL_PARAM>::value\
Chris@16 127 , RETURN_VALUE >::type\
Chris@16 128 PUB_FUNCTION(ARG1 arg1, const BOOST_MOVE_TEMPL_PARAM &u)\
Chris@16 129 { return FWD_FUNCTION(arg1, u); }\
Chris@16 130 \
Chris@16 131 template<class BOOST_MOVE_TEMPL_PARAM>\
Chris@16 132 typename ::boost::enable_if_c<\
Chris@16 133 !::boost::move_detail::is_rv<BOOST_MOVE_TEMPL_PARAM>::value && \
Chris@16 134 !::boost::is_same<TYPE, BOOST_MOVE_TEMPL_PARAM>::value && \
Chris@16 135 !::boost::is_convertible<BOOST_MOVE_TEMPL_PARAM, UNLESS_CONVERTIBLE_TO>::value \
Chris@16 136 , RETURN_VALUE >::type\
Chris@16 137 PUB_FUNCTION(ARG1 arg1, const BOOST_MOVE_TEMPL_PARAM &u)\
Chris@16 138 {\
Chris@16 139 TYPE t(u);\
Chris@16 140 return FWD_FUNCTION(arg1, ::boost::move(t));\
Chris@16 141 }\
Chris@16 142 //
Chris@16 143
Chris@16 144 #elif (defined(_MSC_VER) && (_MSC_VER == 1600))
Chris@16 145
Chris@16 146 #define BOOST_MOVE_CONVERSION_AWARE_CATCH_1ARG(PUB_FUNCTION, TYPE, RETURN_VALUE, FWD_FUNCTION, ARG1, UNLESS_CONVERTIBLE_TO)\
Chris@16 147 RETURN_VALUE PUB_FUNCTION(ARG1 arg1, BOOST_MOVE_CATCH_CONST(TYPE) x)\
Chris@16 148 { return FWD_FUNCTION(arg1, static_cast<const TYPE&>(x)); }\
Chris@16 149 \
Chris@16 150 RETURN_VALUE PUB_FUNCTION(ARG1 arg1, BOOST_MOVE_CATCH_RVALUE(TYPE) x) \
Chris@16 151 { return FWD_FUNCTION(arg1, ::boost::move(x)); }\
Chris@16 152 \
Chris@16 153 template<class BOOST_MOVE_TEMPL_PARAM>\
Chris@16 154 typename ::boost::enable_if_c\
Chris@16 155 < !::boost::is_same<TYPE, BOOST_MOVE_TEMPL_PARAM>::value && \
Chris@16 156 !::boost::is_convertible<BOOST_MOVE_TEMPL_PARAM, UNLESS_CONVERTIBLE_TO>::value \
Chris@16 157 , RETURN_VALUE >::type\
Chris@16 158 PUB_FUNCTION(ARG1 arg1, const BOOST_MOVE_TEMPL_PARAM &u)\
Chris@16 159 {\
Chris@16 160 TYPE t(u);\
Chris@16 161 return FWD_FUNCTION(arg1, ::boost::move(t));\
Chris@16 162 }\
Chris@16 163 //
Chris@16 164
Chris@16 165 #else
Chris@16 166
Chris@16 167 #define BOOST_MOVE_CONVERSION_AWARE_CATCH_1ARG(PUB_FUNCTION, TYPE, RETURN_VALUE, FWD_FUNCTION, ARG1, UNLESS_CONVERTIBLE_TO)\
Chris@16 168 RETURN_VALUE PUB_FUNCTION(ARG1 arg1, BOOST_MOVE_CATCH_CONST(TYPE) x)\
Chris@16 169 { return FWD_FUNCTION(arg1, static_cast<const TYPE&>(x)); }\
Chris@16 170 \
Chris@16 171 RETURN_VALUE PUB_FUNCTION(ARG1 arg1, BOOST_MOVE_CATCH_RVALUE(TYPE) x) \
Chris@16 172 { return FWD_FUNCTION(arg1, ::boost::move(x)); }\
Chris@16 173 //
Chris@16 174
Chris@16 175 #endif
Chris@16 176
Chris@16 177 #endif //#ifndef BOOST_MOVE_MOVE_HELPERS_HPP