* include/bits/move.h (swap(T&, T&), swap(T (&)[N], T (&)[N])): Use
        _GLIBCXX_NOEXCEPT_IF to simplify declarations.

This just avoids having to repeat the name and parameter-list of the
functions.

Tested powerpc64le-linux, committed to trunk.


commit ce102c5eec35cd400a7be641f82ca19ac9521470
Author: Jonathan Wakely <jwak...@redhat.com>
Date:   Tue Sep 9 16:52:46 2014 +0100

    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.

diff --git a/libstdc++-v3/include/bits/move.h b/libstdc++-v3/include/bits/move.h
index 9ebf4453cdd..996078cfbce 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]);

Reply via email to