]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
stl_queue.h (queue<>::push(value_type&&)): Replace with "emplace" version per DR...
authorPaolo Carlini <pcarlini@suse.de>
Thu, 1 Nov 2007 01:40:56 +0000 (01:40 +0000)
committerPaolo Carlini <paolo@gcc.gnu.org>
Thu, 1 Nov 2007 01:40:56 +0000 (01:40 +0000)
2007-10-31  Paolo Carlini  <pcarlini@suse.de>

* include/bits/stl_queue.h (queue<>::push(value_type&&)): Replace
with "emplace" version per DR 756.
(priority_queue<>::push(value_type&&)): Likewise.
* include/bits/stl_stack.h (stack<>::push(value_type&&)): Likewise.

From-SVN: r129814

libstdc++-v3/ChangeLog
libstdc++-v3/include/bits/stl_queue.h
libstdc++-v3/include/bits/stl_stack.h

index 2b783daf8bb7321e8a43634672351dbb1da6275a..f2ea755669a910acc75d4105d3eb20f92fadf865 100644 (file)
@@ -1,3 +1,10 @@
+2007-10-31  Paolo Carlini  <pcarlini@suse.de>
+
+       * include/bits/stl_queue.h (queue<>::push(value_type&&)): Replace
+       with "emplace" version per DR 756.
+       (priority_queue<>::push(value_type&&)): Likewise.
+       * include/bits/stl_stack.h (stack<>::push(value_type&&)): Likewise.
+
 2007-10-30  Paolo Carlini  <pcarlini@suse.de>
 
        * include/tr1_impl/random (uniform_int<>::
index d772c0360acfc4ad5452215ecf78ac94fb1af03f..4ab3c46c0b890a08bc9542922ab42c9fa091bb96 100644 (file)
@@ -220,14 +220,16 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
        *  to it.  The time complexity of the operation depends on the
        *  underlying sequence.
        */
+#ifndef __GXX_EXPERIMENTAL_CXX0X__
       void
       push(const value_type& __x)
       { c.push_back(__x); }
-
-#ifdef __GXX_EXPERIMENTAL_CXX0X__
-      void
-      push(value_type&& __x)
-      { c.push_back(std::move(__x)); }
+#else
+      // NB: DR 756.
+      template<typename... _Args>
+        void
+        push(_Args&&... __args)
+       { c.push_back(std::forward<_Args>(__args)...); }
 #endif
 
       /**
@@ -507,20 +509,22 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
        *  The time complexity of the operation depends on the underlying
        *  sequence.
        */
+#ifndef __GXX_EXPERIMENTAL_CXX0X__
       void
       push(const value_type& __x)
       {
        c.push_back(__x);
        std::push_heap(c.begin(), c.end(), comp);
       }
-
-#ifdef __GXX_EXPERIMENTAL_CXX0X__
-      void
-      push(value_type&& __x)
-      {
-       c.push_back(std::move(__x));
-       std::push_heap(c.begin(), c.end(), comp);
-      }
+#else
+      // NB: DR 756.
+      template<typename... _Args>
+        void
+        push(_Args&&... __args)
+       { 
+         c.push_back(std::forward<_Args>(__args)...);
+         std::push_heap(c.begin(), c.end(), comp);
+       }
 #endif
 
       /**
index 8af33970f1d3803e4c396ea4613769c884657a18..932388a7a68b99007ca3bc4101d55e65167a0ced 100644 (file)
@@ -184,14 +184,16 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
        *  to it.  The time complexity of the operation depends on the
        *  underlying sequence.
        */
+#ifndef __GXX_EXPERIMENTAL_CXX0X__
       void
       push(const value_type& __x)
       { c.push_back(__x); }
-
-#ifdef __GXX_EXPERIMENTAL_CXX0X__
-      void
-      push(value_type&& __x)
-      { c.push_back(std::move(__x)); }
+#else
+      // NB: DR 756.
+      template<typename... _Args>
+        void
+        push(_Args&&... __args)
+       { c.push_back(std::forward<_Args>(__args)...); }
 #endif
 
       /**