Commit 81912fb3 by Jonathan Wakely Committed by Jonathan Wakely

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
parent 7bbdd8d1
2019-04-29 Jonathan Wakely <jwakely@redhat.com> 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 PR libstdc++/71312
* src/c++11/shared_ptr.cc (get_mutex): Align pool mutexes to 64 bytes. * src/c++11/shared_ptr.cc (get_mutex): Align pool mutexes to 64 bytes.
......
...@@ -179,13 +179,12 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -179,13 +179,12 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
typename enable_if<__and_<__not_<__is_tuple_like<_Tp>>, typename enable_if<__and_<__not_<__is_tuple_like<_Tp>>,
is_move_constructible<_Tp>, is_move_constructible<_Tp>,
is_move_assignable<_Tp>>::value>::type 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 #else
void void
swap(_Tp& __a, _Tp& __b)
#endif #endif
swap(_Tp& __a, _Tp& __b)
_GLIBCXX_NOEXCEPT_IF((__and_<is_nothrow_move_constructible<_Tp>,
is_nothrow_move_assignable<_Tp>>::value))
{ {
// concept requirements // concept requirements
__glibcxx_function_requires(_SGIAssignableConcept<_Tp>) __glibcxx_function_requires(_SGIAssignableConcept<_Tp>)
...@@ -202,12 +201,11 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -202,12 +201,11 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
inline inline
#if __cplusplus >= 201103L #if __cplusplus >= 201103L
typename enable_if<__is_swappable<_Tp>::value>::type typename enable_if<__is_swappable<_Tp>::value>::type
swap(_Tp (&__a)[_Nm], _Tp (&__b)[_Nm])
noexcept(__is_nothrow_swappable<_Tp>::value)
#else #else
void void
swap(_Tp (&__a)[_Nm], _Tp (&__b)[_Nm])
#endif #endif
swap(_Tp (&__a)[_Nm], _Tp (&__b)[_Nm])
_GLIBCXX_NOEXCEPT_IF(__is_nothrow_swappable<_Tp>::value)
{ {
for (size_t __n = 0; __n < _Nm; ++__n) for (size_t __n = 0; __n < _Nm; ++__n)
swap(__a[__n], __b[__n]); swap(__a[__n], __b[__n]);
......
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