aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaolo Carlini <pcarlini@suse.de>2007-11-01 01:40:56 +0000
committerPaolo Carlini <paolo@gcc.gnu.org>2007-11-01 01:40:56 +0000
commitc54171fee6142ce7ad3d0ae20a26f68ce053fd85 (patch)
treeb1572adaeb85be07c23ecff5d44311be7603e911
parente52e300091886960831525c52e2209e5714570ef (diff)
downloadgcc-c54171fee6142ce7ad3d0ae20a26f68ce053fd85.zip
gcc-c54171fee6142ce7ad3d0ae20a26f68ce053fd85.tar.gz
gcc-c54171fee6142ce7ad3d0ae20a26f68ce053fd85.tar.bz2
stl_queue.h (queue<>::push(value_type&&)): Replace with "emplace" version per DR 756.
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
-rw-r--r--libstdc++-v3/ChangeLog7
-rw-r--r--libstdc++-v3/include/bits/stl_queue.h30
-rw-r--r--libstdc++-v3/include/bits/stl_stack.h12
3 files changed, 31 insertions, 18 deletions
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog
index 2b783da..f2ea755 100644
--- a/libstdc++-v3/ChangeLog
+++ b/libstdc++-v3/ChangeLog
@@ -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<>::
diff --git a/libstdc++-v3/include/bits/stl_queue.h b/libstdc++-v3/include/bits/stl_queue.h
index d772c03..4ab3c46 100644
--- a/libstdc++-v3/include/bits/stl_queue.h
+++ b/libstdc++-v3/include/bits/stl_queue.h
@@ -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
/**
diff --git a/libstdc++-v3/include/bits/stl_stack.h b/libstdc++-v3/include/bits/stl_stack.h
index 8af3397..932388a 100644
--- a/libstdc++-v3/include/bits/stl_stack.h
+++ b/libstdc++-v3/include/bits/stl_stack.h
@@ -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
/**