This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
[patch] : Fix operator+ in random_access_iterator_wrapper.
- From: Christopher Jefferson <caj at cs dot york dot ac dot uk>
- To: libstdc++ <libstdc++ at gcc dot gnu dot org>, gcc-patches at gcc dot gnu dot org
- Date: Wed, 20 Apr 2005 22:01:20 +0100
- Subject: [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