summaryrefslogtreecommitdiff
path: root/include/tools/unqidx.hxx
diff options
context:
space:
mode:
authorMatteo Casalin <matteo.casalin@yahoo.com>2016-03-05 14:59:11 +0100
committerNoel Grandin <noelgrandin@gmail.com>2016-03-06 06:39:26 +0000
commit078188793b2753bf607bb629464935ccefd28136 (patch)
tree71370822febbc9d695766e1d5f79a180aa041eaa /include/tools/unqidx.hxx
parentbc2e74f3c3093819c499921cf62615e9a8d7301c (diff)
Remove unuseful nStartIndex data member (and fix indexing)
The methods that modify nUinqIndex already maintain class invariants: * Insert() never decrease its value * Remove() can replace its value with that of the removed item, which was no lower than the one specified in constructor call. Besides, boundary checks against nStartIndex are not really needed since the various methods rely on map::find. Finally, FirstIndex/NextIndex/LastIndex/GetIndexOf did not adjust with nStartIndex the index value retrieved from tha map, thus provifing wrong values. Since the map now stores the real indexes, consistency is granted. Change-Id: I5e47cd2672677805304d4c4860826fe272812abf Reviewed-on: https://gerrit.libreoffice.org/22935 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
Diffstat (limited to 'include/tools/unqidx.hxx')
-rw-r--r--include/tools/unqidx.hxx6
1 files changed, 2 insertions, 4 deletions
diff --git a/include/tools/unqidx.hxx b/include/tools/unqidx.hxx
index b6d65b4db3ec..99c565540be7 100644
--- a/include/tools/unqidx.hxx
+++ b/include/tools/unqidx.hxx
@@ -31,13 +31,11 @@ public:
private:
std::map<Index, void*> maMap;
- const Index nStartIndex;
Index nUniqIndex;
public:
- UniqueIndexImpl( Index _nStartIndex = 0 )
- : maMap(),
- nStartIndex(_nStartIndex), nUniqIndex(_nStartIndex) {}
+ UniqueIndexImpl( Index nStartIndex = 0 )
+ : maMap(), nUniqIndex(nStartIndex) {}
Index Insert( void* p );
// insert value with key, replacing existing entry if necessary