aboutsummaryrefslogtreecommitdiff
path: root/libstdc++-v3/include/std/tuple
diff options
context:
space:
mode:
Diffstat (limited to 'libstdc++-v3/include/std/tuple')
-rw-r--r--libstdc++-v3/include/std/tuple89
1 files changed, 42 insertions, 47 deletions
diff --git a/libstdc++-v3/include/std/tuple b/libstdc++-v3/include/std/tuple
index d64c141878d..b870234c129 100644
--- a/libstdc++-v3/include/std/tuple
+++ b/libstdc++-v3/include/std/tuple
@@ -72,11 +72,12 @@ namespace std
_Head_base()
: _Head() { }
- _Head_base(typename __add_c_ref<_Head>::type __h)
+ _Head_base(const _Head& __h)
: _Head(__h) { }
- _Head_base(typename std::remove_reference<_Head>::type&& __h)
- : _Head(std::forward<_Head>(__h)) { }
+ template<typename _UHead>
+ _Head_base(_UHead&& __h)
+ : _Head(std::forward<_UHead>(__h)) { }
_Head& _M_head() { return *this; }
const _Head& _M_head() const { return *this; }
@@ -88,11 +89,12 @@ namespace std
_Head_base()
: _M_head_impl() { }
- _Head_base(typename __add_c_ref<_Head>::type __h)
+ _Head_base(const _Head& __h)
: _M_head_impl(__h) { }
- _Head_base(typename std::remove_reference<_Head>::type&& __h)
- : _M_head_impl(std::move(__h)) { }
+ template<typename _UHead>
+ _Head_base(_UHead&& __h)
+ : _M_head_impl(std::forward<_UHead>(__h)) { }
_Head& _M_head() { return _M_head_impl; }
const _Head& _M_head() const { return _M_head_impl; }
@@ -141,23 +143,21 @@ namespace std
: _Inherited(), _Base() { }
explicit
- _Tuple_impl(typename __add_c_ref<_Head>::type __head,
- typename __add_c_ref<_Tail>::type... __tail)
+ _Tuple_impl(const _Head& __head, const _Tail&... __tail)
: _Inherited(__tail...), _Base(__head) { }
template<typename _UHead, typename... _UTail>
explicit
- _Tuple_impl(typename std::remove_reference<_UHead>::type&& __head,
- typename std::remove_reference<_UTail>::type&&... __tail)
- : _Inherited(std::forward<_Inherited>(__tail)...),
- _Base(std::forward<_Base>(__head)) { }
+ _Tuple_impl(_UHead&& __head, _UTail&&... __tail)
+ : _Inherited(std::forward<_UTail>(__tail)...),
+ _Base(std::forward<_UHead>(__head)) { }
_Tuple_impl(const _Tuple_impl& __in)
: _Inherited(__in._M_tail()), _Base(__in._M_head()) { }
_Tuple_impl(_Tuple_impl&& __in)
- : _Inherited(std::forward<_Inherited>(__in._M_tail())),
- _Base(std::forward<_Base>(__in._M_head())) { }
+ : _Inherited(std::move<_Inherited&&>(__in._M_tail())),
+ _Base(std::forward<_Head>(__in._M_head())) { }
template<typename... _UElements>
_Tuple_impl(const _Tuple_impl<_Idx, _UElements...>& __in)
@@ -165,8 +165,10 @@ namespace std
template<typename... _UElements>
_Tuple_impl(_Tuple_impl<_Idx, _UElements...>&& __in)
- : _Inherited(std::forward<_Inherited>(__in._M_tail())),
- _Base(std::forward<_Base>(__in._M_head())) { }
+ : _Inherited(std::move<typename _Tuple_impl<_Idx, _UElements...>::
+ _Inherited&&>(__in._M_tail())),
+ _Base(std::forward<typename _Tuple_impl<_Idx, _UElements...>::
+ _Base>(__in._M_head())) { }
_Tuple_impl&
operator=(const _Tuple_impl& __in)
@@ -219,21 +221,28 @@ namespace std
template<typename... _UElements>
explicit
tuple(_UElements&&... __elements)
- : _Inherited(std::forward<_UElements>(__elements)...) { }
+ : _Inherited(std::forward<_UElements>(__elements)...) { }
tuple(const tuple& __in)
- : _Inherited(__in) { }
+ : _Inherited(static_cast<const _Inherited&>(__in)) { }
tuple(tuple&& __in)
- : _Inherited(std::move(__in)) { }
+ : _Inherited(std::move<_Inherited>(__in)) { }
template<typename... _UElements>
tuple(const tuple<_UElements...>& __in)
- : _Inherited(__in) { }
+ : _Inherited(static_cast<const _Tuple_impl<0, _UElements...>&>(__in))
+ { }
template<typename... _UElements>
tuple(tuple<_UElements...>&& __in)
- : _Inherited(std::move(__in)) { }
+ : _Inherited(std::move<_Tuple_impl<0, _UElements...> >(__in)) { }
+
+ // XXX http://gcc.gnu.org/ml/libstdc++/2008-02/msg00047.html
+ template<typename... _UElements>
+ tuple(tuple<_UElements...>& __in)
+ : _Inherited(static_cast<const _Tuple_impl<0, _UElements...>&>(__in))
+ { }
tuple&
operator=(const tuple& __in)
@@ -288,34 +297,26 @@ namespace std
: _Inherited(std::forward<_U1>(__a1), std::forward<_U2>(__a2)) { }
tuple(const tuple& __in)
- : _Inherited(__in) { }
+ : _Inherited(static_cast<const _Inherited&>(__in)) { }
tuple(tuple&& __in)
- : _Inherited(std::move(__in)) { }
+ : _Inherited(std::move<_Inherited>(__in)) { }
template<typename _U1, typename _U2>
tuple(const tuple<_U1, _U2>& __in)
- : _Inherited(__in) { }
+ : _Inherited(static_cast<const _Tuple_impl<0, _U1, _U2>&>(__in)) { }
template<typename _U1, typename _U2>
tuple(tuple<_U1, _U2>&& __in)
- : _Inherited(std::move(__in)) { }
+ : _Inherited(std::move<_Tuple_impl<0, _U1, _U2> >(__in)) { }
template<typename _U1, typename _U2>
tuple(const pair<_U1, _U2>& __in)
- : _Inherited(_Tuple_impl<0,
- typename __add_c_ref<_U1>::type,
- typename __add_c_ref<_U2>::type>(__in.first,
- __in.second))
- { }
+ : _Inherited(__in.first, __in.second) { }
template<typename _U1, typename _U2>
tuple(pair<_U1, _U2>&& __in)
- : _Inherited(_Tuple_impl<0,
- typename std::remove_reference<_U1>::type&&,
- typename std::remove_reference<_U2>::type&&>
- (std::move(__in.first), std::move(__in.second)))
- { }
+ : _Inherited(std::move(__in.first), std::move(__in.second)) { }
tuple&
operator=(const tuple& __in)
@@ -555,8 +556,8 @@ namespace std
const __index_holder<_TIdx...>&,
const tuple<_UElements...>& __u,
const __index_holder<_UIdx...>&)
- { return tuple<_TElements..., _UElements...>(std::move(get<_TIdx>(__t))...,
- get<_UIdx>(__u)...); }
+ { return tuple<_TElements..., _UElements...>
+ (std::move(get<_TIdx>(__t))..., get<_UIdx>(__u)...); }
template<typename... _TElements, int... _TIdx,
typename... _UElements, int... _UIdx>
@@ -565,8 +566,8 @@ namespace std
const __index_holder<_TIdx...>&,
tuple<_UElements...>&& __u,
const __index_holder<_UIdx...>&)
- { return tuple<_TElements..., _UElements...>(get<_TIdx>(__t)...,
- std::move(get<_UIdx>(__u))...); }
+ { return tuple<_TElements..., _UElements...>
+ (get<_TIdx>(__t)..., std::move(get<_UIdx>(__u))...); }
template<typename... _TElements, int... _TIdx,
typename... _UElements, int... _UIdx>
@@ -575,8 +576,8 @@ namespace std
const __index_holder<_TIdx...>&,
tuple<_UElements...>&& __u,
const __index_holder<_UIdx...>&)
- { return tuple<_TElements..., _UElements...>(std::move(get<_TIdx>(__t))...,
- std::move(get<_UIdx>(__u))...); }
+ { return tuple<_TElements..., _UElements...>
+ (std::move(get<_TIdx>(__t))..., std::move(get<_UIdx>(__u))...); }
template<typename... _TElements, typename... _UElements>
inline tuple<_TElements..., _UElements...>
@@ -618,12 +619,6 @@ namespace std
__make_index_holder<_UElements...>::type());
}
- template<typename... _TElements, typename... _UElements>
- tuple<_TElements..., _UElements...>
- operator+(tuple<_TElements...>&& __t, tuple<_UElements...>&& __u)
- { return tuple_cat(std::forward<decltype(__t)>(__t),
- std::forward<decltype(__u)>(__u)); }
-
template<typename... _Elements>
inline tuple<_Elements&...>
tie(_Elements&... __args)