]> gcc.gnu.org Git - gcc.git/commitdiff
moveable.cc: Remove dg-require-rvalref.
authorPaolo Carlini <pcarlini@suse.de>
Sat, 6 Oct 2007 02:33:12 +0000 (02:33 +0000)
committerPaolo Carlini <paolo@gcc.gnu.org>
Sat, 6 Oct 2007 02:33:12 +0000 (02:33 +0000)
2007-10-05  Paolo Carlini  <pcarlini@suse.de>

* testsuite/23_containers/map/moveable.cc: Remove dg-require-rvalref.
* testsuite/23_containers/multimap/moveable.cc: Likewise.
* testsuite/23_containers/set/moveable.cc: Likewise.
* testsuite/23_containers/multiset/moveable.cc: Likewise.
* testsuite/23_containers/deque/moveable.cc: Likewise.
* testsuite/23_containers/list/moveable.cc: Likewise.
* testsuite/23_containers/vector/moveable.cc: Likewise.
* include/std/utility: Use _GLIBCXX_BEGIN_NAMESPACE.

2007-10-05  Paolo Carlini  <pcarlini@suse.de>
    Chris Jefferson  <chris@bubblescope.net>

* include/bits/stl_iterator.h (class move_iterator,
make_move_iterator): Add.

Co-Authored-By: Chris Jefferson <chris@bubblescope.net>
From-SVN: r129048

libstdc++-v3/ChangeLog
libstdc++-v3/include/bits/stl_iterator.h
libstdc++-v3/include/std/utility
libstdc++-v3/testsuite/23_containers/deque/moveable.cc
libstdc++-v3/testsuite/23_containers/list/moveable.cc
libstdc++-v3/testsuite/23_containers/map/moveable.cc
libstdc++-v3/testsuite/23_containers/multimap/moveable.cc
libstdc++-v3/testsuite/23_containers/multiset/moveable.cc
libstdc++-v3/testsuite/23_containers/set/moveable.cc
libstdc++-v3/testsuite/23_containers/vector/moveable.cc

index cfd6c2f54be59559f2f0cd3544e1a90b560f16d6..712cde5d5d1fb111f89d610ceb7c0fc3c541de3a 100644 (file)
@@ -1,3 +1,20 @@
+2007-10-05  Paolo Carlini  <pcarlini@suse.de>
+
+       * testsuite/23_containers/map/moveable.cc: Remove dg-require-rvalref.
+       * testsuite/23_containers/multimap/moveable.cc: Likewise.
+       * testsuite/23_containers/set/moveable.cc: Likewise. 
+       * testsuite/23_containers/multiset/moveable.cc: Likewise.
+       * testsuite/23_containers/deque/moveable.cc: Likewise. 
+       * testsuite/23_containers/list/moveable.cc: Likewise. 
+       * testsuite/23_containers/vector/moveable.cc: Likewise. 
+       * include/std/utility: Use _GLIBCXX_BEGIN_NAMESPACE.
+
+2007-10-05  Paolo Carlini  <pcarlini@suse.de>
+           Chris Jefferson  <chris@bubblescope.net>
+
+       * include/bits/stl_iterator.h (class move_iterator,
+       make_move_iterator): Add.
+
 2007-10-04  Doug Kwan  <dougkwan@google.com>
 
        * include/ext/concurrent.h (class __mutex,
index d7c092602341732474a14b08640c34ddd535c50e..ac561eee351d3e0558aa213fd370097864511ee8 100644 (file)
@@ -826,4 +826,173 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
 
 _GLIBCXX_END_NAMESPACE
 
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+
+_GLIBCXX_BEGIN_NAMESPACE(std)
+
+  // 24.4.3  Move iterators
+  /**
+   *  @if maint
+   *  Class template move_iterator is an iterator adapter with the same
+   *  behavior as the underlying iterator except that its dereference
+   *  operator implicitly converts the value returned by the underlying
+   *  iterator's dereference operator to an rvalue reference.  Some
+   *  generic algorithms can be called with move iterators to replace
+   *  copying with moving.
+   *  @endif
+   */
+  template<typename _Iterator>
+    class move_iterator
+    {
+    protected:
+      _Iterator _M_current;
+
+    public:
+      typedef _Iterator                                        iterator_type;
+      typedef typename iterator_traits<_Iterator>::difference_type
+                                                               difference_type;
+      typedef typename iterator_traits<_Iterator>::pointer     pointer;
+      typedef typename iterator_traits<_Iterator>::value_type  value_type;
+      typedef typename iterator_traits<_Iterator>::iterator_category
+                                                               iterator_category;
+      typedef value_type&&                                     reference;
+
+    public:
+      move_iterator()
+      : _M_current() { }
+
+      explicit
+      move_iterator(iterator_type __i)
+      : _M_current(__i) { }
+
+      template<typename _Iter>
+       move_iterator(const move_iterator<_Iter>& __i)
+       : _M_current(__i.base()) { }
+
+      iterator_type
+      base() const
+      { return _M_current; }
+
+      reference
+      operator*() const
+      { return *_M_current; }
+
+      pointer
+      operator->() const
+      { return _M_current; }
+
+      move_iterator&
+      operator++()
+      {
+       ++_M_current;
+       return *this;
+      }
+
+      move_iterator
+      operator++(int)
+      {
+       move_iterator __tmp = *this;
+       ++_M_current;
+       return __tmp;
+      }
+
+      move_iterator&
+      operator--()
+      {
+       --_M_current;
+       return *this;
+      }
+
+      move_iterator
+      operator--(int)
+      {
+       move_iterator __tmp = *this;
+       --_M_current;
+       return __tmp;
+      }
+
+      move_iterator
+      operator+(difference_type __n) const
+      { return move_iterator(_M_current + __n); }
+
+      move_iterator&
+      operator+=(difference_type __n)
+      {
+       _M_current += __n;
+       return *this;
+      }
+
+      move_iterator
+      operator-(difference_type __n) const
+      { return move_iterator(_M_current - __n); }
+    
+      move_iterator&
+      operator-=(difference_type __n)
+      { 
+       _M_current -= __n;
+       return *this;
+      }
+
+      reference
+      operator[](difference_type __n) const
+      { return _M_current[__n]; }
+    };
+
+  template<typename _IteratorL, typename _IteratorR>
+    inline bool
+    operator==(const move_iterator<_IteratorL>& __x,
+              const move_iterator<_IteratorR>& __y)
+    { return __x.base() == __y.base(); }
+
+  template<typename _IteratorL, typename _IteratorR>
+    inline bool
+    operator!=(const move_iterator<_IteratorL>& __x,
+              const move_iterator<_IteratorR>& __y)
+    { return !(__x == __y); }
+
+  template<typename _IteratorL, typename _IteratorR>
+    inline bool
+    operator<(const move_iterator<_IteratorL>& __x,
+             const move_iterator<_IteratorR>& __y)
+    { return __x.base() < __y.base(); }
+
+  template<typename _IteratorL, typename _IteratorR>
+    inline bool
+    operator<=(const move_iterator<_IteratorL>& __x,
+              const move_iterator<_IteratorR>& __y)
+    { return !(__y < __x); }
+
+  template<typename _IteratorL, typename _IteratorR>
+    inline bool
+    operator>(const move_iterator<_IteratorL>& __x,
+             const move_iterator<_IteratorR>& __y)
+    { return __y < __x; }
+
+  template<typename _IteratorL, typename _IteratorR>
+    inline bool
+    operator>=(const move_iterator<_IteratorL>& __x,
+              const move_iterator<_IteratorR>& __y)
+    { return !(__x < __y); }
+
+  template<typename _IteratorL, typename _IteratorR>
+    inline typename move_iterator<_IteratorL>::difference_type
+    operator-(const move_iterator<_IteratorL>& __x,
+             const move_iterator<_IteratorR>& __y)
+    { return __x.base() - __y.base(); }
+
+  template<typename _Iterator>
+    inline move_iterator<_Iterator>
+    operator+(typename move_iterator<_Iterator>::difference_type __n,
+             const move_iterator<_Iterator>& __x)
+    { return __x + __n; }
+
+  template<typename _Iterator>
+    inline move_iterator<_Iterator>
+    make_move_iterator(const _Iterator& __i)
+    { return move_iterator<_Iterator>(__i); }
+
+_GLIBCXX_END_NAMESPACE
+
+#endif // __GXX_EXPERIMENTAL_CXX0X__
+
 #endif
index e9376dc8c70525836fca50797be8cbbb3f2057e2..5020b95b4f80d6e1e46f3a270c2daacdd228f0d0 100644 (file)
@@ -87,8 +87,8 @@
 
 #include <type_traits>
 
-namespace std
-{
+_GLIBCXX_BEGIN_NAMESPACE(std)
+
   // 20.2.2, forward/move
   template<typename _Tp>
     struct identity
@@ -105,7 +105,8 @@ namespace std
     inline typename std::remove_reference<_Tp>::type&&
     move(_Tp&& __t)
     { return __t; }
-}
+
+_GLIBCXX_END_NAMESPACE
 
 #endif
 
index e1fe8aea6acaf63d558daae50129c2df845f0a3c..ae532de978016f992884bc216076412e6e111da6 100644 (file)
@@ -1,4 +1,3 @@
-// { dg-require-rvalref "" }
 // { dg-options "-std=gnu++0x" }
 
 // Copyright (C) 2005, 2007 Free Software Foundation, Inc.
index 19b5ea111cef0f59ba470686b1ac7be85e175e58..d3f1031f91f142320e19bf0e2c76294a46bf5641 100644 (file)
@@ -1,4 +1,3 @@
-// { dg-require-rvalref "" }
 // { dg-options "-std=gnu++0x" }
 
 // Copyright (C) 2005, 2007 Free Software Foundation, Inc.
index ca2a2f305bfb7fd3baf08f71859287a567e250ac..52447083b2ebf6ff1eb3fc405be5c795f2581aad 100644 (file)
@@ -1,4 +1,3 @@
-// { dg-require-rvalref "" }
 // { dg-options "-std=gnu++0x" }
 
 // Copyright (C) 2005, 2007 Free Software Foundation, Inc.
index 75bfd433ce3fe18b8e2e78fad90b6cc3bf12391c..87796f496f38c9ec2bdf94f247ed5e4fd7a99158 100644 (file)
@@ -1,4 +1,3 @@
-// { dg-require-rvalref "" }
 // { dg-options "-std=gnu++0x" }
 
 // Copyright (C) 2005, 2007 Free Software Foundation, Inc.
@@ -33,6 +32,7 @@
 // this test may begin to fail.
 
 #include <map>
+#include <utility>
 #include <testsuite_hooks.h>
 
 int main()
index 5cd4f3244e11d47268aa9008311f31eab13a462e..c3ca111804d095d4a61df817f0cc914ffe9d29e5 100644 (file)
@@ -1,4 +1,3 @@
-// { dg-require-rvalref "" }
 // { dg-options "-std=gnu++0x" }
 
 // Copyright (C) 2005, 2007 Free Software Foundation, Inc.
index 81ca041f6be5084418b4d49149b6d88eaf61b3be..b85ae58ba06d47429db8d7e021375a640db5df59 100644 (file)
@@ -1,4 +1,3 @@
-// { dg-require-rvalref "" }
 // { dg-options "-std=gnu++0x" }
 
 // Copyright (C) 2005, 2007 Free Software Foundation, Inc.
index 289a4333f129a0cdd5ecea86809f2e302c733f29..df825f3d00765815560783a61a5e16377246de82 100644 (file)
@@ -1,4 +1,3 @@
-// { dg-require-rvalref "" }
 // { dg-options "-std=gnu++0x" }
 
 // Copyright (C) 2005, 2007 Free Software Foundation, Inc.
This page took 0.077483 seconds and 5 git commands to generate.