From 2869bf9f1ea05d07d7e30b669cf67f71d17ad29f Mon Sep 17 00:00:00 2001 From: Eric Lemanissier Date: Mon, 5 Mar 2018 16:59:11 +0100 Subject: implement non-member operator+ for iterators all of these iterator classes already have a member operator+, which allows iter+int. This commits addes non-member operator+, which allows int+iter, and forwards to the member QList and QArrayData iterators now satisfy RandomAccessIterator concept Change-Id: I25c1dd8cea299e735d5a5e288dbe23dc1d7a1933 Reviewed-by: Thiago Macieira --- src/corelib/tools/qhash.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/corelib/tools/qhash.h') diff --git a/src/corelib/tools/qhash.h b/src/corelib/tools/qhash.h index ce663ce2ca..a586ca5671 100644 --- a/src/corelib/tools/qhash.h +++ b/src/corelib/tools/qhash.h @@ -348,6 +348,7 @@ public: inline iterator operator-(int j) const { return operator+(-j); } inline iterator &operator+=(int j) { return *this = *this + j; } inline iterator &operator-=(int j) { return *this = *this - j; } + friend inline iterator operator+(int j, iterator k) { return k + j; } #ifndef QT_STRICT_ITERATORS public: @@ -413,6 +414,7 @@ public: inline const_iterator operator-(int j) const { return operator+(-j); } inline const_iterator &operator+=(int j) { return *this = *this + j; } inline const_iterator &operator-=(int j) { return *this = *this - j; } + friend inline const_iterator operator+(int j, const_iterator k) { return k + j; } // ### Qt 5: not sure this is necessary anymore #ifdef QT_STRICT_ITERATORS -- cgit v1.2.3