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