gcc-patches@gcc.gnu.org
[Top] [All Lists]

[v3] Patch to priority_queue::push/pop

Subject: [v3] Patch to priority_queue::push/pop
From: Paolo Carlini
Date: Fri, 04 Aug 2006 11:36:57 +0200
Hi,

per the discussion on the libstdc++ list. Tested x86-linux, committed to mainline.

Paolo.

//////////////////
2006-08-04  Paolo Carlini  <pcarlini@xxxxxxx>

        * include/bits/stl_queue.h (priority_queue<>::push,
        priority_queue<>::pop): Remove try/catch, just follow the
        letter of the Standard.
Index: include/bits/stl_queue.h
===================================================================
--- include/bits/stl_queue.h    (revision 115911)
+++ include/bits/stl_queue.h    (working copy)
@@ -424,16 +424,8 @@
       void
       push(const value_type& __x)
       {
-       try
-        {
-          c.push_back(__x);
-          std::push_heap(c.begin(), c.end(), comp);
-        }
-       catch(...)
-        {
-          c.clear();
-          __throw_exception_again;
-        }
+       c.push_back(__x);
+       std::push_heap(c.begin(), c.end(), comp);
       }
 
       /**
@@ -451,16 +443,8 @@
       pop()
       {
        __glibcxx_requires_nonempty();
-       try
-        {
-          std::pop_heap(c.begin(), c.end(), comp);
-          c.pop_back();
-        }
-       catch(...)
-        {
-          c.clear();
-          __throw_exception_again;
-        }
+       std::pop_heap(c.begin(), c.end(), comp);
+       c.pop_back();
       }
     };
 
<Prev in Thread] Current Thread [Next in Thread>
  • [v3] Patch to priority_queue::push/pop, Paolo Carlini <=