This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[v3] Adjust a few *_iterator bits for C++0x
- From: Paolo Carlini <pcarlini at suse dot de>
- To: Gcc Patch List <gcc-patches at gcc dot gnu dot org>
- Date: Wed, 17 Oct 2007 19:46:14 +0200
- Subject: [v3] Adjust a few *_iterator bits for C++0x
Hi,
tested x86_64-linux, committed to mainline.
Paolo.
PS: about the tweak to the existing assignment, see c++/33801.
///////////////////
2007-10-17 Paolo Carlini <pcarlini@suse.de>
* include/bits/stl_iterator.h (back_insert_iterator<>::operator=
(typename _Container::value_type&&), front_insert_iterator<>::
operator=(typename _Container::value_type&&), insert_iterator<>::
operator=(typename _Container::value_type&&)): Add.
* include/bits/stl_iterator.h (insert_iterator<>::operator=
(typename _Container::const_reference)): Fix typo in signature.
Index: include/bits/stl_iterator.h
===================================================================
--- include/bits/stl_iterator.h (revision 129398)
+++ include/bits/stl_iterator.h (working copy)
@@ -68,6 +68,7 @@
#include <bits/cpp_type_traits.h>
#include <ext/type_traits.h>
+#include <bits/stl_move.h>
_GLIBCXX_BEGIN_NAMESPACE(std)
@@ -414,6 +415,15 @@
return *this;
}
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ back_insert_iterator&
+ operator=(typename _Container::value_type&& __value)
+ {
+ container->push_back(std::move(__value));
+ return *this;
+ }
+#endif
+
/// Simply returns *this.
back_insert_iterator&
operator*()
@@ -488,6 +498,15 @@
return *this;
}
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ front_insert_iterator&
+ operator=(typename _Container::value_type&& __value)
+ {
+ container->push_front(std::move(__value));
+ return *this;
+ }
+#endif
+
/// Simply returns *this.
front_insert_iterator&
operator*()
@@ -577,13 +596,23 @@
* @endcode
*/
insert_iterator&
- operator=(const typename _Container::const_reference __value)
+ operator=(typename _Container::const_reference __value)
{
iter = container->insert(iter, __value);
++iter;
return *this;
}
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ insert_iterator&
+ operator=(typename _Container::value_type&& __value)
+ {
+ iter = container->insert(iter, std::move(__value));
+ ++iter;
+ return *this;
+ }
+#endif
+
/// Simply returns *this.
insert_iterator&
operator*()