sc/inc/table.hxx | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
New commits: commit f599ff99ecb405e2934c8d4d472e54fd4064a26a Author: Eike Rathke <er...@redhat.com> Date: Wed Feb 21 15:24:02 2018 +0100 Use iterator pre-increment/decrement Change-Id: I079850116648dc69b8c92fa23b30233f63d9b6e7 diff --git a/sc/inc/table.hxx b/sc/inc/table.hxx index b7d6c344e57f..a7b3e6352cec 100644 --- a/sc/inc/table.hxx +++ b/sc/inc/table.hxx @@ -133,8 +133,8 @@ class ScColumnsRange final explicit Iterator(const std::vector<ScColumn*>::const_iterator& colIter) : maColIter(colIter) {} - Iterator& operator++() { maColIter++; return *this;} - Iterator& operator--() { maColIter--; return *this;} + Iterator& operator++() { ++maColIter; return *this;} + Iterator& operator--() { --maColIter; return *this;} bool operator==(const Iterator & rOther) const {return maColIter == rOther.maColIter;} bool operator!=(const Iterator & rOther) const {return !(*this == rOther);} commit 581b845509d20fa864b00088ed649f30fe4e1109 Author: Eike Rathke <er...@redhat.com> Date: Wed Feb 21 15:13:11 2018 +0100 Pass ScColumnsRange::Iterator as const& Specifically for each operator==() call two temporaries were copied, for operator!=() even twice as much.. in for(...:GetColumnsRange()) Change-Id: I4b426ae855454544e50efca35aa73303138f7ba7 diff --git a/sc/inc/table.hxx b/sc/inc/table.hxx index c3c65a0b81d5..b7d6c344e57f 100644 --- a/sc/inc/table.hxx +++ b/sc/inc/table.hxx @@ -131,17 +131,17 @@ class ScColumnsRange final typedef const SCCOL* pointer; typedef SCCOL reference; - explicit Iterator(std::vector<ScColumn*>::const_iterator colIter) : maColIter(colIter) {} + explicit Iterator(const std::vector<ScColumn*>::const_iterator& colIter) : maColIter(colIter) {} Iterator& operator++() { maColIter++; return *this;} Iterator& operator--() { maColIter--; return *this;} - bool operator==(Iterator other) const {return maColIter == other.maColIter;} - bool operator!=(Iterator other) const {return !(*this == other);} + bool operator==(const Iterator & rOther) const {return maColIter == rOther.maColIter;} + bool operator!=(const Iterator & rOther) const {return !(*this == rOther);} SCCOL operator*() const {return (*maColIter)->GetCol();} }; - ScColumnsRange(Iterator nBegin, Iterator nEnd) : maBegin(nBegin), maEnd(nEnd) {} + ScColumnsRange(const Iterator & rBegin, const Iterator & rEnd) : maBegin(rBegin), maEnd(rEnd) {} const Iterator & begin() { return maBegin; } const Iterator & end() { return maEnd; } std::reverse_iterator<Iterator> rbegin() { return std::reverse_iterator<Iterator>(maEnd); } _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits