Commit b1bb4869 by Jonathan Wakely Committed by Jonathan Wakely

Add noexcept to tuple<> and simplify tuple<T1,T2> noexcept-specifiers

	* include/std/tuple (tuple<>): Add noexcept to allocator-extended
	constructors.
	(tuple<T1, T2>::__nothrow_default_constructible()): New helper
	function.
	(tuple<T1, T2>::tuple(), explicit tuple<T1, T2>::tuple()): Use helper.

From-SVN: r271814
parent 1facd627
2019-05-31 Jonathan Wakely <jwakely@redhat.com> 2019-05-31 Jonathan Wakely <jwakely@redhat.com>
* include/std/tuple (tuple<>): Add noexcept to allocator-extended
constructors.
(tuple<T1, T2>::__nothrow_default_constructible()): New helper
function.
(tuple<T1, T2>::tuple(), explicit tuple<T1, T2>::tuple()): Use helper.
2019-05-31 Jonathan Wakely <jwakely@redhat.com>
* src/c++98/bitmap_allocator.cc: Add using-declaration for size_t. * src/c++98/bitmap_allocator.cc: Add using-declaration for size_t.
PR libstdc++/90682 PR libstdc++/90682
......
...@@ -898,9 +898,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -898,9 +898,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
tuple() = default; tuple() = default;
// No-op allocator constructors. // No-op allocator constructors.
template<typename _Alloc> template<typename _Alloc>
tuple(allocator_arg_t, const _Alloc&) { } tuple(allocator_arg_t, const _Alloc&) noexcept { }
template<typename _Alloc> template<typename _Alloc>
tuple(allocator_arg_t, const _Alloc&, const tuple&) { } tuple(allocator_arg_t, const _Alloc&, const tuple&) noexcept { }
}; };
/// Partial specialization, 2-element tuple. /// Partial specialization, 2-element tuple.
...@@ -925,11 +925,17 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -925,11 +925,17 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
} }
template<typename _U1, typename _U2> template<typename _U1, typename _U2>
static constexpr bool __nothrow_constructible() static constexpr bool __nothrow_constructible()
{ {
return __and_<is_nothrow_constructible<_T1, _U1>, return __and_<is_nothrow_constructible<_T1, _U1>,
is_nothrow_constructible<_T2, _U2>>::value; is_nothrow_constructible<_T2, _U2>>::value;
} }
static constexpr bool __nothrow_default_constructible()
{
return __and_<is_nothrow_default_constructible<_T1>,
is_nothrow_default_constructible<_T2>>::value;
}
public: public:
template <typename _U1 = _T1, template <typename _U1 = _T1,
...@@ -939,8 +945,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -939,8 +945,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
__is_implicitly_default_constructible<_U2>> __is_implicitly_default_constructible<_U2>>
::value, bool>::type = true> ::value, bool>::type = true>
constexpr tuple() constexpr tuple()
noexcept(__and_<is_nothrow_default_constructible<_T1>, noexcept(__nothrow_default_constructible())
is_nothrow_default_constructible<_T2>>::value)
: _Inherited() { } : _Inherited() { }
template <typename _U1 = _T1, template <typename _U1 = _T1,
...@@ -954,8 +959,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -954,8 +959,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
__is_implicitly_default_constructible<_U2>>>> __is_implicitly_default_constructible<_U2>>>>
::value, bool>::type = false> ::value, bool>::type = false>
explicit constexpr tuple() explicit constexpr tuple()
noexcept(__and_<is_nothrow_default_constructible<_T1>, noexcept(__nothrow_default_constructible())
is_nothrow_default_constructible<_T2>>::value)
: _Inherited() { } : _Inherited() { }
// Shortcut for the cases where constructors taking _T1, _T2 // Shortcut for the cases where constructors taking _T1, _T2
...@@ -1108,7 +1112,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -1108,7 +1112,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
&& _TCC<_Dummy>::template && _TCC<_Dummy>::template
_ImplicitlyConvertibleTuple<_T1, _T2>(), _ImplicitlyConvertibleTuple<_T1, _T2>(),
bool>::type=true> bool>::type=true>
tuple(allocator_arg_t __tag, const _Alloc& __a, tuple(allocator_arg_t __tag, const _Alloc& __a,
const _T1& __a1, const _T2& __a2) const _T1& __a1, const _T2& __a2)
: _Inherited(__tag, __a, __a1, __a2) { } : _Inherited(__tag, __a, __a1, __a2) { }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment