Patchwork [v3] Use noexcept in the container adaptors

login
register
mail settings
Submitter Paolo Carlini
Date May 26, 2011, 12:38 a.m.
Message ID <4DDDA108.4000203@oracle.com>
Download mbox | patch
Permalink /patch/97480/
State New
Headers show

Comments

Paolo Carlini - May 26, 2011, 12:38 a.m.
Hi,

tested x86_64-linux, committed.

Paolo.

/////////////////////
2011-05-25  Paolo Carlini  <paolo.carlini@oracle.com>

	* include/bits/stl_queue.h: Use noexcept per the FDIS.
	* include/bits/stl_stack.h: Likewise.

Patch

Index: include/bits/stl_queue.h
===================================================================
--- include/bits/stl_queue.h	(revision 174245)
+++ include/bits/stl_queue.h	(working copy)
@@ -243,6 +243,7 @@ 
 #ifdef __GXX_EXPERIMENTAL_CXX0X__
       void
       swap(queue& __q)
+      noexcept(noexcept(swap(c, __q.c)))
       {
 	using std::swap;
 	swap(c, __q.c);
@@ -312,6 +313,7 @@ 
   template<typename _Tp, typename _Seq>
     inline void
     swap(queue<_Tp, _Seq>& __x, queue<_Tp, _Seq>& __y)
+    noexcept(noexcept(__x.swap(__y)))
     { __x.swap(__y); }
 
   template<typename _Tp, typename _Seq, typename _Alloc>
@@ -530,6 +532,7 @@ 
 #ifdef __GXX_EXPERIMENTAL_CXX0X__
       void
       swap(priority_queue& __pq)
+      noexcept(noexcept(swap(c, __pq.c)) && noexcept(swap(comp, __pq.comp)))
       {
 	using std::swap;
 	swap(c, __pq.c);
@@ -545,6 +548,7 @@ 
     inline void
     swap(priority_queue<_Tp, _Sequence, _Compare>& __x,
 	 priority_queue<_Tp, _Sequence, _Compare>& __y)
+    noexcept(noexcept(__x.swap(__y)))
     { __x.swap(__y); }
 
   template<typename _Tp, typename _Sequence, typename _Compare,
Index: include/bits/stl_stack.h
===================================================================
--- include/bits/stl_stack.h	(revision 174245)
+++ include/bits/stl_stack.h	(working copy)
@@ -217,6 +217,7 @@ 
 #ifdef __GXX_EXPERIMENTAL_CXX0X__
       void
       swap(stack& __s)
+      noexcept(noexcept(swap(c, __s.c)))
       {
 	using std::swap;
 	swap(c, __s.c);
@@ -287,6 +288,7 @@ 
   template<typename _Tp, typename _Seq>
     inline void
     swap(stack<_Tp, _Seq>& __x, stack<_Tp, _Seq>& __y)
+    noexcept(noexcept(__x.swap(__y)))
     { __x.swap(__y); }
 
   template<typename _Tp, typename _Seq, typename _Alloc>