This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
tuple move constructor
- From: Marc Glisse <marc dot glisse at inria dot fr>
- To: libstdc++ at gcc dot gnu dot org
- Date: Wed, 20 Apr 2016 22:42:48 +0200 (CEST)
- Subject: tuple move constructor
- Authentication-results: sourceware.org; auth=none
- Reply-to: libstdc++ at gcc dot gnu dot org
Hello,
does anyone remember why the move constructor of _Tuple_impl is not
defaulted? The attached patch does not cause any test to fail (whitespace
kept to avoid line number changes). Maybe something about tuples of
references?
I don't remember how I noticed, maybe some is_trivial trait was failing
unexpectedly, or the move constructor was not deleted when I expected
it to be...
--
Marc Glisse
Index: libstdc++-v3/include/std/tuple
===================================================================
--- libstdc++-v3/include/std/tuple (revision 234507)
+++ libstdc++-v3/include/std/tuple (working copy)
@@ -208,25 +208,25 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
template<typename _UHead, typename... _UTail, typename = typename
enable_if<sizeof...(_Tail) == sizeof...(_UTail)>::type>
explicit
constexpr _Tuple_impl(_UHead&& __head, _UTail&&... __tail)
: _Inherited(std::forward<_UTail>(__tail)...),
_Base(std::forward<_UHead>(__head)) { }
constexpr _Tuple_impl(const _Tuple_impl&) = default;
constexpr
- _Tuple_impl(_Tuple_impl&& __in)
- noexcept(__and_<is_nothrow_move_constructible<_Head>,
- is_nothrow_move_constructible<_Inherited>>::value)
- : _Inherited(std::move(_M_tail(__in))),
- _Base(std::forward<_Head>(_M_head(__in))) { }
+ _Tuple_impl(_Tuple_impl&&) = default;
+
+
+
+
template<typename... _UElements>
constexpr _Tuple_impl(const _Tuple_impl<_Idx, _UElements...>& __in)
: _Inherited(_Tuple_impl<_Idx, _UElements...>::_M_tail(__in)),
_Base(_Tuple_impl<_Idx, _UElements...>::_M_head(__in)) { }
template<typename _UHead, typename... _UTails>
constexpr _Tuple_impl(_Tuple_impl<_Idx, _UHead, _UTails...>&& __in)
: _Inherited(std::move
(_Tuple_impl<_Idx, _UHead, _UTails...>::_M_tail(__in))),
@@ -356,23 +356,23 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
: _Base(__head) { }
template<typename _UHead>
explicit
constexpr _Tuple_impl(_UHead&& __head)
: _Base(std::forward<_UHead>(__head)) { }
constexpr _Tuple_impl(const _Tuple_impl&) = default;
constexpr
- _Tuple_impl(_Tuple_impl&& __in)
- noexcept(is_nothrow_move_constructible<_Head>::value)
- : _Base(std::forward<_Head>(_M_head(__in))) { }
+ _Tuple_impl(_Tuple_impl&&) = default;
+
+
template<typename _UHead>
constexpr _Tuple_impl(const _Tuple_impl<_Idx, _UHead>& __in)
: _Base(_Tuple_impl<_Idx, _UHead>::_M_head(__in)) { }
template<typename _UHead>
constexpr _Tuple_impl(_Tuple_impl<_Idx, _UHead>&& __in)
: _Base(std::forward<_UHead>(_Tuple_impl<_Idx, _UHead>::_M_head(__in)))
{ }