From: Jonathan Wakely Date: Fri, 31 May 2019 14:58:05 +0000 (+0100) Subject: Add noexcept to tuple<> and simplify tuple noexcept-specifiers X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=b1bb4869e2708c1385352e4d960833e1b258859b;p=gcc.git Add noexcept to tuple<> and simplify tuple noexcept-specifiers * include/std/tuple (tuple<>): Add noexcept to allocator-extended constructors. (tuple::__nothrow_default_constructible()): New helper function. (tuple::tuple(), explicit tuple::tuple()): Use helper. From-SVN: r271814 --- diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 7dc8e581318..3d9d5919e5b 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,11 @@ +2019-05-31 Jonathan Wakely + + * include/std/tuple (tuple<>): Add noexcept to allocator-extended + constructors. + (tuple::__nothrow_default_constructible()): New helper + function. + (tuple::tuple(), explicit tuple::tuple()): Use helper. + 2019-05-31 Jonathan Wakely * src/c++98/bitmap_allocator.cc: Add using-declaration for size_t. diff --git a/libstdc++-v3/include/std/tuple b/libstdc++-v3/include/std/tuple index b81157c097b..64516b1dece 100644 --- a/libstdc++-v3/include/std/tuple +++ b/libstdc++-v3/include/std/tuple @@ -898,9 +898,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION tuple() = default; // No-op allocator constructors. template - tuple(allocator_arg_t, const _Alloc&) { } + tuple(allocator_arg_t, const _Alloc&) noexcept { } template - tuple(allocator_arg_t, const _Alloc&, const tuple&) { } + tuple(allocator_arg_t, const _Alloc&, const tuple&) noexcept { } }; /// Partial specialization, 2-element tuple. @@ -925,11 +925,17 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION } template - static constexpr bool __nothrow_constructible() - { - return __and_, - is_nothrow_constructible<_T2, _U2>>::value; - } + static constexpr bool __nothrow_constructible() + { + return __and_, + is_nothrow_constructible<_T2, _U2>>::value; + } + + static constexpr bool __nothrow_default_constructible() + { + return __and_, + is_nothrow_default_constructible<_T2>>::value; + } public: template > ::value, bool>::type = true> constexpr tuple() - noexcept(__and_, - is_nothrow_default_constructible<_T2>>::value) + noexcept(__nothrow_default_constructible()) : _Inherited() { } template >>> ::value, bool>::type = false> explicit constexpr tuple() - noexcept(__and_, - is_nothrow_default_constructible<_T2>>::value) + noexcept(__nothrow_default_constructible()) : _Inherited() { } // Shortcut for the cases where constructors taking _T1, _T2 @@ -1108,7 +1112,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION && _TCC<_Dummy>::template _ImplicitlyConvertibleTuple<_T1, _T2>(), bool>::type=true> - tuple(allocator_arg_t __tag, const _Alloc& __a, const _T1& __a1, const _T2& __a2) : _Inherited(__tag, __a, __a1, __a2) { }