Skip to content

Commit 1d39092

Browse files
committed
ModelIterator: fix it++ being used when ++it will do
As can be clearly seen from the implementations of the postfix operators surrounding the use of the postfix operator, the prefix operators are more efficient. Fixes cppcheck's postfixOperator. Fix useless inline keyword (implied when the function definiton is in the class' body) and non-standard spacing in affected lines as a drive-by. Change-Id: I16e60e37e55cd561ef7a9a853ae0ae522d1c40d7 Reviewed-on: https://codereview.kdab.com/c/kdab/KDToolBox/+/99627 Reviewed-by: André Somers <[email protected]>
1 parent c08fcc3 commit 1d39092

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

qt/model_view/ModelIterator/src/ModelIterator.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -205,9 +205,9 @@ class DataValueWrapper
205205
inline DataValueWrapper operator+(int step) {return DataValueWrapper(it + step);}
206206
inline DataValueWrapper operator-(int step) {return DataValueWrapper(it - step);}
207207

208-
inline DataValueWrapper& operator++() {it++; return *this;}
208+
DataValueWrapper& operator++() { ++it; return *this; }
209209
inline DataValueWrapper operator++(int) {DataValueWrapper tmp(*this); operator++(); return tmp;}
210-
inline DataValueWrapper& operator--() {it--; return *this;}
210+
DataValueWrapper& operator--() { --it; return *this; }
211211
inline DataValueWrapper operator--(int) {DataValueWrapper tmp(*this); operator--(); return tmp;}
212212

213213
inline bool operator==(const DataValueWrapper& other) {return it == other.it;}

0 commit comments

Comments
 (0)