git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@119545 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Howard Hinnant
2010-11-17 19:52:17 +00:00
parent 86ed8aefb2
commit cd2254b454
7 changed files with 164 additions and 0 deletions

View File

@@ -100,6 +100,10 @@ template<size_t I, class T1, class T2>
const typename const tuple_element<I, std::pair<T1, T2> >::type&
get(const std::pair<T1, T2>&);
template<size_t I, class T1, class T2>
typename tuple_element<I, std::pair<T1, T2> >::type&&
get(std::pair<T1, T2>&&);
} // std
*/
@@ -425,6 +429,16 @@ struct __get_pair<0>
_LIBCPP_INLINE_VISIBILITY
const _T1&
get(const pair<_T1, _T2>& __p) {return __p.first;}
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
template <class _T1, class _T2>
static
_LIBCPP_INLINE_VISIBILITY
_T1&&
get(pair<_T1, _T2>&& __p) {return _STD::forward<_T1>(__p.first);}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
};
template <>
@@ -441,6 +455,16 @@ struct __get_pair<1>
_LIBCPP_INLINE_VISIBILITY
const _T2&
get(const pair<_T1, _T2>& __p) {return __p.second;}
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
template <class _T1, class _T2>
static
_LIBCPP_INLINE_VISIBILITY
_T2&&
get(pair<_T1, _T2>&& __p) {return _STD::forward<_T2>(__p.second);}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
};
template <size_t _Ip, class _T1, class _T2>
@@ -459,6 +483,18 @@ get(const pair<_T1, _T2>& __p)
return __get_pair<_Ip>::get(__p);
}
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
template <size_t _Ip, class _T1, class _T2>
_LIBCPP_INLINE_VISIBILITY inline
typename tuple_element<_Ip, pair<_T1, _T2> >::type&&
get(pair<_T1, _T2>&& __p)
{
return __get_pair<_Ip>::get(_STD::move(__p));
}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
#endif // _LIBCPP_HAS_NO_VARIADICS
_LIBCPP_END_NAMESPACE_STD