Commit 4c7aaebf by Paolo Carlini Committed by Paolo Carlini

move.h (forward): Reinstate the N2835 version.

2010-08-11  Paolo Carlini  <paolo.carlini@oracle.com>

	* include/bits/move.h (forward): Reinstate the N2835 version.

From-SVN: r163101
parent be94d007
2010-08-11 Paolo Carlini <paolo.carlini@oracle.com> 2010-08-11 Paolo Carlini <paolo.carlini@oracle.com>
* include/bits/move.h (forward): Reinstate the N2835 version.
2010-08-11 Paolo Carlini <paolo.carlini@oracle.com>
PR libstdc++/42925 PR libstdc++/42925
* include/bits/unique_ptr.h (operator==(const unique_ptr<>&, * include/bits/unique_ptr.h (operator==(const unique_ptr<>&,
nullptr_t), operator==(nullptr_t, const unique_ptr<>&), nullptr_t), operator==(nullptr_t, const unique_ptr<>&),
......
...@@ -51,16 +51,29 @@ _GLIBCXX_END_NAMESPACE ...@@ -51,16 +51,29 @@ _GLIBCXX_END_NAMESPACE
_GLIBCXX_BEGIN_NAMESPACE(std) _GLIBCXX_BEGIN_NAMESPACE(std)
/// forward /// forward (as per N2835)
template<typename _Tp, typename _Up> /// Forward lvalues as rvalues.
inline typename template<typename _Tp>
enable_if<((std::is_convertible< inline typename enable_if<!is_lvalue_reference<_Tp>::value, _Tp&&>::type
typename std::remove_reference<_Up>::type*, forward(typename std::common_type<_Tp>::type& __t)
typename std::remove_reference<_Tp>::type*>::value) { return static_cast<_Tp&&>(__t); }
&& (!std::is_lvalue_reference<_Tp>::value
|| std::is_lvalue_reference<_Up>::value)), _Tp&&>::type /// Forward rvalues as rvalues.
forward(_Up&& __u) template<typename _Tp>
{ return static_cast<_Tp&&>(__u); } inline typename enable_if<!is_lvalue_reference<_Tp>::value, _Tp&&>::type
forward(typename std::common_type<_Tp>::type&& __t)
{ return static_cast<_Tp&&>(__t); }
// Forward lvalues as lvalues.
template<typename _Tp>
inline typename enable_if<is_lvalue_reference<_Tp>::value, _Tp>::type
forward(typename std::common_type<_Tp>::type __t)
{ return __t; }
// Prevent forwarding rvalues as const lvalues.
template<typename _Tp>
inline typename enable_if<is_lvalue_reference<_Tp>::value, _Tp>::type
forward(typename std::remove_reference<_Tp>::type&& __t) = delete;
/** /**
* @brief Move a value. * @brief Move a value.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment