Attempt to make std::pair piecewise constructor noexcept

Jonathan Wakely jwakely@redhat.com
Fri Dec 21 13:47:00 GMT 2018


On 16/12/18 18:48 +0100, François Dumont wrote:
>@@ -372,7 +361,16 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
> 	  second(std::forward<_U2>(__p.second)) { }
> 
>       template<typename... _Args1, typename... _Args2>
>-        pair(piecewise_construct_t, tuple<_Args1...>, tuple<_Args2...>);
>+	pair(piecewise_construct_t,
>+	     tuple<_Args1...> __first, tuple<_Args2...> __second)
>+	noexcept( noexcept(
>+	  pair(declval<tuple<_Args1...>&>(), declval<tuple<_Args2...>&>(),
>+	       declval<typename _Build_index_tuple<sizeof...(_Args1)>::__type>(),
>+	       declval<typename _Build_index_tuple<sizeof...(_Args2)>::__type>())) )
>+	: pair(__first, __second,
>+	       typename _Build_index_tuple<sizeof...(_Args1)>::__type(),
>+	       typename _Build_index_tuple<sizeof...(_Args2)>::__type())
>+	{ }

Surely just:

      noexcept(
	is_nothrow_constructible<_T1, _Args1...>
        &&
	is_nothrow_constructible<_T2, _Args2...>
      )

?



More information about the Libstdc++ mailing list