aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonathan Wakely <jwakely@redhat.com>2019-04-29 14:25:38 +0100
committerJonathan Wakely <redi@gcc.gnu.org>2019-04-29 14:25:38 +0100
commit81912fb385a91073efd327354fc01f17641a9c6b (patch)
tree726f77656eb8f594017b6c3cae5189dc01773792
parent7bbdd8d13e6cc06d77321209a945edf64350a5ac (diff)
downloadgcc-81912fb385a91073efd327354fc01f17641a9c6b.zip
gcc-81912fb385a91073efd327354fc01f17641a9c6b.tar.gz
gcc-81912fb385a91073efd327354fc01f17641a9c6b.tar.bz2
Use _GLIBCXX_NOEXCEPT_IF for std::swap
* include/bits/move.h (swap(T&, T&), swap(T (&)[N], T (&)[N])): Use _GLIBCXX_NOEXCEPT_IF to simplify declarations. From-SVN: r270650
-rw-r--r--libstdc++-v3/ChangeLog3
-rw-r--r--libstdc++-v3/include/bits/move.h12
2 files changed, 8 insertions, 7 deletions
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog
index 2168a79..b93f670 100644
--- a/libstdc++-v3/ChangeLog
+++ b/libstdc++-v3/ChangeLog
@@ -1,5 +1,8 @@
2019-04-29 Jonathan Wakely <jwakely@redhat.com>
+ * include/bits/move.h (swap(T&, T&), swap(T (&)[N], T (&)[N])): Use
+ _GLIBCXX_NOEXCEPT_IF to simplify declarations.
+
PR libstdc++/71312
* src/c++11/shared_ptr.cc (get_mutex): Align pool mutexes to 64 bytes.
diff --git a/libstdc++-v3/include/bits/move.h b/libstdc++-v3/include/bits/move.h
index 9ebf445..996078c 100644
--- a/libstdc++-v3/include/bits/move.h
+++ b/libstdc++-v3/include/bits/move.h
@@ -179,13 +179,12 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
typename enable_if<__and_<__not_<__is_tuple_like<_Tp>>,
is_move_constructible<_Tp>,
is_move_assignable<_Tp>>::value>::type
- swap(_Tp& __a, _Tp& __b)
- noexcept(__and_<is_nothrow_move_constructible<_Tp>,
- is_nothrow_move_assignable<_Tp>>::value)
#else
void
- swap(_Tp& __a, _Tp& __b)
#endif
+ swap(_Tp& __a, _Tp& __b)
+ _GLIBCXX_NOEXCEPT_IF((__and_<is_nothrow_move_constructible<_Tp>,
+ is_nothrow_move_assignable<_Tp>>::value))
{
// concept requirements
__glibcxx_function_requires(_SGIAssignableConcept<_Tp>)
@@ -202,12 +201,11 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
inline
#if __cplusplus >= 201103L
typename enable_if<__is_swappable<_Tp>::value>::type
- swap(_Tp (&__a)[_Nm], _Tp (&__b)[_Nm])
- noexcept(__is_nothrow_swappable<_Tp>::value)
#else
void
- swap(_Tp (&__a)[_Nm], _Tp (&__b)[_Nm])
#endif
+ swap(_Tp (&__a)[_Nm], _Tp (&__b)[_Nm])
+ _GLIBCXX_NOEXCEPT_IF(__is_nothrow_swappable<_Tp>::value)
{
for (size_t __n = 0; __n < _Nm; ++__n)
swap(__a[__n], __b[__n]);