[Libreoffice-commits] core.git: Branch 'libreoffice-6-0' - sc/inc
Eike Rathke
erack at redhat.com
Thu Feb 22 13:35:48 UTC 2018
sc/inc/table.hxx | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
New commits:
commit 2110c7260ef8f536e2d8517145b91a62b6c52b68
Author: Eike Rathke <erack at redhat.com>
Date: Wed Feb 21 15:13:11 2018 +0100
Pass ScColumnsRange::Iterator as const& and use pre-increment/decrement
This is a combination of 2 commits.
Pass ScColumnsRange::Iterator as const&
Specifically for each operator==() call two temporaries were
copied, for operator!=() even twice as much.. in
for(...:GetColumnsRange())
(cherry picked from commit 581b845509d20fa864b00088ed649f30fe4e1109)
Conflicts:
sc/inc/table.hxx
Use iterator pre-increment/decrement
(cherry picked from commit f599ff99ecb405e2934c8d4d472e54fd4064a26a)
079850116648dc69b8c92fa23b30233f63d9b6e7
Change-Id: I4b426ae855454544e50efca35aa73303138f7ba7
Reviewed-on: https://gerrit.libreoffice.org/50113
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Caolán McNamara <caolanm at redhat.com>
Tested-by: Caolán McNamara <caolanm at redhat.com>
diff --git a/sc/inc/table.hxx b/sc/inc/table.hxx
index 2ec2cd87e892..d6af98d394f0 100644
--- a/sc/inc/table.hxx
+++ b/sc/inc/table.hxx
@@ -130,17 +130,17 @@ class ScColumnsRange final
{
std::vector<ScColumn*>::const_iterator maColIter;
public:
- 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;}
+ 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);}
reference 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); }
More information about the Libreoffice-commits
mailing list