summaryrefslogtreecommitdiff
path: root/libstdc++-v3/include
diff options
context:
space:
mode:
authorJonathan Wakely <jwakely.gcc@gmail.com>2011-12-06 15:13:04 +0000
committerPaolo Carlini <paolo@gcc.gnu.org>2011-12-06 15:13:04 +0000
commit62b547b5f6aa7b86cd6a29501fd0ed2c259e1f6d (patch)
tree44ef218cd901a8d4cee7ffbbed9e50f7894de307 /libstdc++-v3/include
parent6232acfe4d905c0e79f3a088c0672eae3cc26eb8 (diff)
downloadgcc-62b547b5f6aa7b86cd6a29501fd0ed2c259e1f6d.tar.gz
re PR libstdc++/51183 (pair piecewise_construct_t constructor copies)
2011-12-06 Jonathan Wakely <jwakely.gcc@gmail.com> Chris Jefferson <chris@bubblescope.net> PR libstdc++/51183 * include/std/stl_pair.h (pair<>::__cons, pair<>::__do_cons): Remove. (pair<>::pair(piecewise_construct_t, tuple<>, tuple<>): Only declare. (pair<>::pair(tuple<>&, tuple<>&, _Index_tuple<>, _Index_tuple<>)): Declare. * include/std/tuple (pair<>::__cons, pair<>::__do_cons): Remove. (pair<>::pair(tuple<>&, tuple<>&, _Index_tuple<>, _Index_tuple<>)): Define. (pair<>::pair(piecewise_construct_t, tuple<>, tuple<>): Define, delegating to the latter. * testsuite/20_util/pair/piecewise2.cc: New. Co-Authored-By: Chris Jefferson <chris@bubblescope.net> From-SVN: r182054
Diffstat (limited to 'libstdc++-v3/include')
-rw-r--r--libstdc++-v3/include/bits/stl_pair.h18
-rw-r--r--libstdc++-v3/include/std/tuple31
2 files changed, 24 insertions, 25 deletions
diff --git a/libstdc++-v3/include/bits/stl_pair.h b/libstdc++-v3/include/bits/stl_pair.h
index bb33cc6437d..c1df571c5d5 100644
--- a/libstdc++-v3/include/bits/stl_pair.h
+++ b/libstdc++-v3/include/bits/stl_pair.h
@@ -149,11 +149,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
: first(std::forward<_U1>(__p.first)),
second(std::forward<_U2>(__p.second)) { }
- template<class... _Args1, class... _Args2>
- pair(piecewise_construct_t,
- tuple<_Args1...> __first, tuple<_Args2...> __second)
- : first(__cons<first_type>(std::move(__first))),
- second(__cons<second_type>(std::move(__second))) { }
+ template<typename... _Args1, typename... _Args2>
+ pair(piecewise_construct_t, tuple<_Args1...>, tuple<_Args2...>);
pair&
operator=(const pair& __p)
@@ -202,13 +199,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
}
private:
- template<typename _Tp, typename... _Args>
- static _Tp
- __cons(tuple<_Args...>&&);
-
- template<typename _Tp, typename... _Args, std::size_t... _Indexes>
- static _Tp
- __do_cons(tuple<_Args...>&&, const _Index_tuple<_Indexes...>&);
+ template<typename... _Args1, std::size_t... _Indexes1,
+ typename... _Args2, std::size_t... _Indexes2>
+ pair(tuple<_Args1...>&, tuple<_Args2...>&,
+ _Index_tuple<_Indexes1...>, _Index_tuple<_Indexes2...>);
#endif
};
diff --git a/libstdc++-v3/include/std/tuple b/libstdc++-v3/include/std/tuple
index 282d4509d3a..e8aaf4610c3 100644
--- a/libstdc++-v3/include/std/tuple
+++ b/libstdc++-v3/include/std/tuple
@@ -1057,21 +1057,26 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
// See stl_pair.h...
template<class _T1, class _T2>
- template<typename _Tp, typename... _Args>
- inline _Tp
- pair<_T1, _T2>::__cons(tuple<_Args...>&& __tuple)
- {
- typedef typename _Build_index_tuple<sizeof...(_Args)>::__type
- _Indexes;
- return __do_cons<_Tp>(std::move(__tuple), _Indexes());
- }
+ template<typename... _Args1, typename... _Args2>
+ inline
+ pair<_T1, _T2>::
+ pair(piecewise_construct_t,
+ tuple<_Args1...> __first, tuple<_Args2...> __second)
+ : pair(__first, __second,
+ typename _Build_index_tuple<sizeof...(_Args1)>::__type(),
+ typename _Build_index_tuple<sizeof...(_Args2)>::__type())
+ { }
template<class _T1, class _T2>
- template<typename _Tp, typename... _Args, std::size_t... _Indexes>
- inline _Tp
- pair<_T1, _T2>::__do_cons(tuple<_Args...>&& __tuple,
- const _Index_tuple<_Indexes...>&)
- { return _Tp(std::forward<_Args>(get<_Indexes>(__tuple))...); }
+ template<typename... _Args1, std::size_t... _Indexes1,
+ typename... _Args2, std::size_t... _Indexes2>
+ inline
+ pair<_T1, _T2>::
+ pair(tuple<_Args1...>& __tuple1, tuple<_Args2...>& __tuple2,
+ _Index_tuple<_Indexes1...>, _Index_tuple<_Indexes2...>)
+ : first(std::forward<_Args1>(std::get<_Indexes1>(__tuple1))...),
+ second(std::forward<_Args2>(std::get<_Indexes2>(__tuple2))...)
+ { }
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace