From 80bcc4e643b89c03ef05d89c00cf1b6178b2a008 Mon Sep 17 00:00:00 2001 From: Jeremy Siek Date: Mon, 20 Nov 2000 18:17:52 +0000 Subject: [PATCH] some concept checking changes as per review comments [SVN r8268] --- include/boost/pending/detail/int_iterator.hpp | 9 ++++++++- include/boost/pending/iterator_tests.hpp | 3 ++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/include/boost/pending/detail/int_iterator.hpp b/include/boost/pending/detail/int_iterator.hpp index 346774c..9fcfffe 100644 --- a/include/boost/pending/detail/int_iterator.hpp +++ b/include/boost/pending/detail/int_iterator.hpp @@ -40,7 +40,7 @@ public: inline self& operator++() { ++_i; return *this; } inline self operator++(int) { self t = *this; ++_i; return t; } inline self& operator+=(IntT n) { _i += n; return *this; } - inline self operator+(IntT n) { self t = *this; t._i += n; return t; } + inline self operator+(IntT n) { self t = *this; t += n; return t; } inline self& operator--() { --_i; return *this; } inline self operator--(int) { self t = *this; --_i; return t; } inline self& operator-=(IntT n) { _i -= n; return *this; } @@ -50,10 +50,17 @@ public: // need to look into this... for now implementing everything here -JGS inline bool operator!=(const self& x) const { return _i != x._i; } inline bool operator<(const self& x) const { return _i < x._i; } + inline bool operator<=(const self& x) const { return _i <= x._i; } + inline bool operator>(const self& x) const { return _i > x._i; } + inline bool operator>=(const self& x) const { return _i >= x._i; } protected: IntT _i; }; +template +inline int_iterator +operator+(IntT n, int_iterator t) { t += n; return t; } + #ifndef BOOST_NO_OPERATORS_IN_NAMESPACE } /* namespace boost */ #endif diff --git a/include/boost/pending/iterator_tests.hpp b/include/boost/pending/iterator_tests.hpp index df74d83..981eb55 100644 --- a/include/boost/pending/iterator_tests.hpp +++ b/include/boost/pending/iterator_tests.hpp @@ -141,7 +141,8 @@ void random_access_iterator_test(Iterator i, int N, TrueVals vals) assert(i == k - c); assert(*i == vals[N - 1 - c]); assert(*i == j[N - 1 - c]); - assert(*i == *(k - c)); + Iterator q = k - c; + assert(*i == *q); assert(i > j); assert(i >= j); assert(j <= i);