This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[patch] : Fix operator+ in random_access_iterator_wrapper.


This small patch fixes operator+ in random_access_iterator_wrapper, a class only used in the libstdc++-v3 testsuite.
2005-04-20  Christopher Jefferson  <chris@bubblescope.net>

	* testsuite/testsuite_iterators.h 
	(random_access_iterator_wrapper::operator+) : move out of
	class to external function,  and add symmetric version.
Index: testsuite_iterators.h
===================================================================
RCS file: /cvsroot/gcc/gcc/libstdc++-v3/testsuite/testsuite_iterators.h,v
retrieving revision 1.1.6.3
diff -u -r1.1.6.3 testsuite_iterators.h
--- testsuite_iterators.h	14 Mar 2005 10:38:04 -0000	1.1.6.3
+++ testsuite_iterators.h	20 Apr 2005 20:56:42 -0000
@@ -444,13 +444,6 @@
       return *this;
     }
 
-    random_access_iterator_wrapper
-    operator+(ptrdiff_t n) const
-    {
-      random_access_iterator_wrapper<T> tmp = *this;
-      return tmp += n;
-    }
-
     random_access_iterator_wrapper&
     operator-=(ptrdiff_t n)
     { return *this += -n; }
@@ -499,6 +492,16 @@
     }
    };
 
+  template<typename T>
+    random_access_iterator_wrapper<T>
+    operator+(random_access_iterator_wrapper<T> it, ptrdiff_t n)
+    { return it += n; }
+
+  template<typename T>
+    random_access_iterator_wrapper<T>
+    operator+(ptrdiff_t n, random_access_iterator_wrapper<T> it) 
+    { return it += n; }
+
 
   /** 
    * @brief A container-type class for holding iterator wrappers

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]