mirror of git://gcc.gnu.org/git/gcc.git
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
This commit is contained in:
parent
be94d007e6
commit
4c7aaebf4d
|
@ -1,3 +1,7 @@
|
||||||
|
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>
|
2010-08-11 Paolo Carlini <paolo.carlini@oracle.com>
|
||||||
|
|
||||||
PR libstdc++/42925
|
PR libstdc++/42925
|
||||||
|
|
|
@ -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.
|
||||||
|
|
Loading…
Reference in New Issue