diff options
author | Eike Rathke <erack@redhat.com> | 2018-02-21 15:13:11 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2018-02-22 14:35:23 +0100 |
commit | 2110c7260ef8f536e2d8517145b91a62b6c52b68 (patch) | |
tree | c87527e0f1a4a5f8ce1a8c57569a0100def64323 /sc | |
parent | 0bcdcd38e336ec65970c870f169e0db2c2f4a2c9 (diff) |
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@libreoffice.org>
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'sc')
-rw-r--r-- | sc/inc/table.hxx | 12 |
1 files changed, 6 insertions, 6 deletions
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); } |