forked from boostorg/move
Fixes #42 ("<boost/move/unique_ptr.hpp> fails when BOOST_MOVE_USE_STANDARD_LIBRARY_MOVE is set")
This commit is contained in:
@@ -258,44 +258,47 @@
|
||||
|
||||
#endif //BOOST_MOVE_DOXYGEN_INVOKED
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// move_if_not_lvalue_reference
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
#if defined(BOOST_MOVE_DOXYGEN_INVOKED)
|
||||
//! <b>Effects</b>: Calls `boost::move` if `input_reference` is not a lvalue reference.
|
||||
//! Otherwise returns the reference
|
||||
template <class T> output_reference move_if_not_lvalue_reference(input_reference) noexcept;
|
||||
#elif defined(BOOST_MOVE_OLD_RVALUE_REF_BINDING_RULES)
|
||||
|
||||
//Old move approach, lvalues could bind to rvalue references
|
||||
|
||||
template <class T>
|
||||
BOOST_MOVE_FORCEINLINE T&& move_if_not_lvalue_reference(typename ::boost::move_detail::identity<T>::type&& t) BOOST_NOEXCEPT
|
||||
{ return t; }
|
||||
|
||||
#else //Old move
|
||||
|
||||
template <class T>
|
||||
BOOST_MOVE_FORCEINLINE T&& move_if_not_lvalue_reference(typename ::boost::move_detail::remove_reference<T>::type& t) BOOST_NOEXCEPT
|
||||
{ return static_cast<T&&>(t); }
|
||||
|
||||
template <class T>
|
||||
BOOST_MOVE_FORCEINLINE T&& move_if_not_lvalue_reference(typename ::boost::move_detail::remove_reference<T>::type&& t) BOOST_NOEXCEPT
|
||||
{
|
||||
//"boost::forward<T> error: 'T' is a lvalue reference, can't forward as rvalue.";
|
||||
BOOST_STATIC_ASSERT(!boost::move_detail::is_lvalue_reference<T>::value);
|
||||
return static_cast<T&&>(t);
|
||||
}
|
||||
|
||||
#endif //BOOST_MOVE_DOXYGEN_INVOKED
|
||||
|
||||
} //namespace boost {
|
||||
|
||||
#endif //#if defined(BOOST_MOVE_USE_STANDARD_LIBRARY_MOVE)
|
||||
#endif //BOOST_MOVE_USE_STANDARD_LIBRARY_MOVE
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// move_if_not_lvalue_reference
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
namespace boost {
|
||||
|
||||
#if defined(BOOST_MOVE_DOXYGEN_INVOKED)
|
||||
//! <b>Effects</b>: Calls `boost::move` if `input_reference` is not a lvalue reference.
|
||||
//! Otherwise returns the reference
|
||||
template <class T> output_reference move_if_not_lvalue_reference(input_reference) noexcept;
|
||||
#elif defined(BOOST_MOVE_OLD_RVALUE_REF_BINDING_RULES)
|
||||
|
||||
//Old move approach, lvalues could bind to rvalue references
|
||||
|
||||
template <class T>
|
||||
BOOST_MOVE_FORCEINLINE T&& move_if_not_lvalue_reference(typename ::boost::move_detail::identity<T>::type&& t) BOOST_NOEXCEPT
|
||||
{ return t; }
|
||||
|
||||
#else //Old move
|
||||
|
||||
template <class T>
|
||||
BOOST_MOVE_FORCEINLINE T&& move_if_not_lvalue_reference(typename ::boost::move_detail::remove_reference<T>::type& t) BOOST_NOEXCEPT
|
||||
{ return static_cast<T&&>(t); }
|
||||
|
||||
template <class T>
|
||||
BOOST_MOVE_FORCEINLINE T&& move_if_not_lvalue_reference(typename ::boost::move_detail::remove_reference<T>::type&& t) BOOST_NOEXCEPT
|
||||
{
|
||||
//"boost::forward<T> error: 'T' is a lvalue reference, can't forward as rvalue.";
|
||||
BOOST_STATIC_ASSERT(!boost::move_detail::is_lvalue_reference<T>::value);
|
||||
return static_cast<T&&>(t);
|
||||
}
|
||||
|
||||
#endif //BOOST_MOVE_DOXYGEN_INVOKED
|
||||
|
||||
} //namespace boost {
|
||||
|
||||
#endif //BOOST_NO_CXX11_RVALUE_REFERENCES
|
||||
|
||||
|
||||
Reference in New Issue
Block a user