[PATCH] more STL work in tools module (6)

Noel Grandin noel at peralex.com
Wed Aug 8 04:11:17 PDT 2012

On 2012-08-08 12:50, Michael Stahl wrote:
> so it gets rid of Container, which is good. the UniqueIndex class used 
> to be some kind of encoding of an associative array into an array, so 
> using a std::map seems appropriate. but i think it would be even 
> better to remove the UniqueIndex class completely
I would have done that, but there are 2 usages of it:

rsc/inc/rscdef.hxx:213:typedef UniqueIndex<RscFile> RscSubFileTab;
tools/inc/tools/pstm.hxx:152:typedef UniqueIndex<SvPersistBase> 

> , it appears that there are still remnants of the old array-mapping in 
> e.g. UniqueIndexImpl::Insert that seem pointless, also the NextIndex() 
> looks rather slow, just using map iterators directly would be faster. 
> just compute the next key on inserting with something like 
> rbegin()->first + 1 (check for empty() first), that could be a 
> stand-alone function at the use site.

UniqueIndex is both a map and a key generator. It also tries to keep the 
key space as small as possible
The key generating part appears to be quite necessary to how the RSC 
module functions.


Disclaimer: http://www.peralex.com/disclaimer.html

More information about the LibreOffice mailing list