File indexing completed on 2025-12-15 09:56:20
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017 #ifndef BOOST_MOVE_MOVE_UTILITY_CORE_HPP
0018 #define BOOST_MOVE_MOVE_UTILITY_CORE_HPP
0019
0020 #ifndef BOOST_CONFIG_HPP
0021 # include <boost/config.hpp>
0022 #endif
0023 #
0024 #if defined(BOOST_HAS_PRAGMA_ONCE)
0025 # pragma once
0026 #endif
0027
0028 #include <boost/move/detail/config_begin.hpp>
0029 #include <boost/move/detail/workaround.hpp> //forceinline
0030 #include <boost/move/core.hpp>
0031 #include <boost/move/detail/meta_utils.hpp>
0032
0033 #if defined(BOOST_NO_CXX11_RVALUE_REFERENCES) && !defined(BOOST_MOVE_DOXYGEN_INVOKED)
0034
0035 namespace boost {
0036
0037 template<class T>
0038 struct enable_move_utility_emulation
0039 {
0040 static const bool value = true;
0041 };
0042
0043
0044
0045
0046
0047
0048
0049 template <class T>
0050 BOOST_MOVE_FORCEINLINE typename ::boost::move_detail::enable_if_and
0051 < T &
0052 , enable_move_utility_emulation<T>
0053 , has_move_emulation_disabled<T>
0054 >::type
0055 move(T& x) BOOST_NOEXCEPT
0056 {
0057 return x;
0058 }
0059
0060 template <class T>
0061 BOOST_MOVE_FORCEINLINE typename ::boost::move_detail::enable_if_and
0062 < rv<T>&
0063 , enable_move_utility_emulation<T>
0064 , has_move_emulation_enabled<T>
0065 >::type
0066 move(T& x) BOOST_NOEXCEPT
0067 {
0068 return *BOOST_MOVE_TO_RV_CAST(::boost::rv<T>*, ::boost::move_detail::addressof(x) );
0069 }
0070
0071 template <class T>
0072 BOOST_MOVE_FORCEINLINE typename ::boost::move_detail::enable_if_and
0073 < rv<T>&
0074 , enable_move_utility_emulation<T>
0075 , has_move_emulation_enabled<T>
0076 >::type
0077 move(rv<T>& x) BOOST_NOEXCEPT
0078 {
0079 return x;
0080 }
0081
0082
0083
0084
0085
0086
0087
0088 template <class T>
0089 BOOST_MOVE_FORCEINLINE typename ::boost::move_detail::enable_if_and
0090 < T &
0091 , enable_move_utility_emulation<T>
0092 , ::boost::move_detail::is_rv<T>
0093 >::type
0094 forward(const typename ::boost::move_detail::identity<T>::type &x) BOOST_NOEXCEPT
0095 {
0096 return const_cast<T&>(x);
0097 }
0098
0099 template <class T>
0100 BOOST_MOVE_FORCEINLINE typename ::boost::move_detail::enable_if_and
0101 < const T &
0102 , enable_move_utility_emulation<T>
0103 , ::boost::move_detail::is_not_rv<T>
0104 >::type
0105 forward(const typename ::boost::move_detail::identity<T>::type &x) BOOST_NOEXCEPT
0106 {
0107 return x;
0108 }
0109
0110
0111
0112
0113
0114
0115
0116 template <class T>
0117 BOOST_MOVE_FORCEINLINE typename ::boost::move_detail::enable_if_and
0118 < T &
0119 , enable_move_utility_emulation<T>
0120 , ::boost::move_detail::is_rv<T>
0121 >::type
0122 move_if_not_lvalue_reference(const typename ::boost::move_detail::identity<T>::type &x) BOOST_NOEXCEPT
0123 {
0124 return const_cast<T&>(x);
0125 }
0126
0127 template <class T>
0128 BOOST_MOVE_FORCEINLINE typename ::boost::move_detail::enable_if_and
0129 < typename ::boost::move_detail::add_lvalue_reference<T>::type
0130 , enable_move_utility_emulation<T>
0131 , ::boost::move_detail::is_not_rv<T>
0132 , ::boost::move_detail::or_
0133 < ::boost::move_detail::is_lvalue_reference<T>
0134 , has_move_emulation_disabled<T>
0135 >
0136 >::type
0137 move_if_not_lvalue_reference(typename ::boost::move_detail::remove_reference<T>::type &x) BOOST_NOEXCEPT
0138 {
0139 return x;
0140 }
0141
0142 template <class T>
0143 BOOST_MOVE_FORCEINLINE typename ::boost::move_detail::enable_if_and
0144 < rv<T>&
0145 , enable_move_utility_emulation<T>
0146 , ::boost::move_detail::is_not_rv<T>
0147 , ::boost::move_detail::and_
0148 < ::boost::move_detail::not_< ::boost::move_detail::is_lvalue_reference<T> >
0149 , has_move_emulation_enabled<T>
0150 >
0151 >::type
0152 move_if_not_lvalue_reference(typename ::boost::move_detail::remove_reference<T>::type &x) BOOST_NOEXCEPT
0153 {
0154 return move(x);
0155 }
0156
0157 }
0158
0159 #else
0160
0161 #if defined(BOOST_MOVE_USE_STANDARD_LIBRARY_MOVE)
0162 #include <utility>
0163
0164 namespace boost{
0165
0166 using ::std::move;
0167 using ::std::forward;
0168
0169 }
0170
0171 #else
0172
0173 namespace boost {
0174
0175
0176
0177
0178
0179
0180
0181 template<class T>
0182 struct enable_move_utility_emulation
0183 {
0184 static const bool value = false;
0185 };
0186
0187
0188
0189
0190
0191
0192
0193 #if defined(BOOST_MOVE_DOXYGEN_INVOKED)
0194
0195
0196
0197
0198 template <class T>
0199 rvalue_reference move(input_reference) noexcept;
0200
0201 #elif defined(BOOST_MOVE_OLD_RVALUE_REF_BINDING_RULES)
0202
0203
0204 template <class T>
0205 BOOST_MOVE_FORCEINLINE typename ::boost::move_detail::remove_reference<T>::type && move(T&& t) BOOST_NOEXCEPT
0206 { return t; }
0207
0208 #else
0209
0210 template <class T>
0211 BOOST_MOVE_INTRINSIC_CAST
0212 typename ::boost::move_detail::remove_reference<T>::type && move(T&& t) BOOST_NOEXCEPT
0213 { return static_cast<typename ::boost::move_detail::remove_reference<T>::type &&>(t); }
0214
0215 #endif
0216
0217
0218
0219
0220
0221
0222
0223
0224 #if defined(BOOST_MOVE_DOXYGEN_INVOKED)
0225
0226
0227
0228
0229
0230
0231
0232
0233
0234
0235
0236 template <class T> output_reference forward(input_reference) noexcept;
0237 #elif defined(BOOST_MOVE_OLD_RVALUE_REF_BINDING_RULES)
0238
0239
0240
0241 template <class T>
0242 BOOST_MOVE_FORCEINLINE T&& forward(typename ::boost::move_detail::identity<T>::type&& t) BOOST_NOEXCEPT
0243 { return t; }
0244
0245 #else
0246
0247 template <class T>
0248 BOOST_MOVE_INTRINSIC_CAST
0249 T&& forward(typename ::boost::move_detail::remove_reference<T>::type& t) BOOST_NOEXCEPT
0250 { return static_cast<T&&>(t); }
0251
0252 template <class T>
0253 BOOST_MOVE_INTRINSIC_CAST
0254 T&& forward(typename ::boost::move_detail::remove_reference<T>::type&& t) BOOST_NOEXCEPT
0255 {
0256
0257 BOOST_MOVE_STATIC_ASSERT(!boost::move_detail::is_lvalue_reference<T>::value);
0258 return static_cast<T&&>(t);
0259 }
0260
0261 #endif
0262
0263 }
0264
0265 #endif
0266
0267
0268
0269
0270
0271
0272
0273 namespace boost {
0274
0275 #if defined(BOOST_MOVE_DOXYGEN_INVOKED)
0276
0277
0278 template <class T> output_reference move_if_not_lvalue_reference(input_reference) noexcept;
0279 #elif defined(BOOST_MOVE_OLD_RVALUE_REF_BINDING_RULES)
0280
0281
0282
0283 template <class T>
0284 BOOST_MOVE_FORCEINLINE T&& move_if_not_lvalue_reference(typename ::boost::move_detail::identity<T>::type&& t) BOOST_NOEXCEPT
0285 { return t; }
0286
0287 #else
0288
0289 template <class T>
0290 BOOST_MOVE_FORCEINLINE T&& move_if_not_lvalue_reference(typename ::boost::move_detail::remove_reference<T>::type& t) BOOST_NOEXCEPT
0291 { return static_cast<T&&>(t); }
0292
0293 template <class T>
0294 BOOST_MOVE_FORCEINLINE T&& move_if_not_lvalue_reference(typename ::boost::move_detail::remove_reference<T>::type&& t) BOOST_NOEXCEPT
0295 {
0296
0297 BOOST_MOVE_STATIC_ASSERT(!boost::move_detail::is_lvalue_reference<T>::value);
0298 return static_cast<T&&>(t);
0299 }
0300
0301 #endif
0302
0303 }
0304
0305 #endif
0306
0307 #if !defined(BOOST_MOVE_DOXYGEN_INVOKED)
0308
0309 namespace boost{
0310 namespace move_detail{
0311
0312 template <typename T>
0313 typename boost::move_detail::add_rvalue_reference<T>::type declval();
0314
0315 }
0316 }
0317
0318 #endif
0319
0320
0321 #include <boost/move/detail/config_end.hpp>
0322
0323 #endif