[PATCH] convert tools/table.hxx to std::map in ScEEParser class in SC module

Ivan Timofeev timofeev.i.s at gmail.com
Mon Mar 12 05:33:44 PDT 2012


Hi Noel,

>  for ( SCCOL nCol = nStartCol; nCol <= nEndCol; nCol++ )
>  {
> -   sal_uInt16 nWidth = (sal_uInt16)(sal_uLong) pColWidths->Get( nCol );
> +   sal_uInt16 nWidth = 0;
> +   if ( rColWidths.find( nCol ) != rColWidths.end() )
> +      nWidth = rColWidths[ nCol ];

so this code performs a search twice - firstly 'find', then 
'operator[]'. And it is in the loop. And it is an import filter. Maybe

   iterator it = rColWidths.find( nCol );
   if ( it != rColWidths.end() )
      nWidth = it->second;

is better? Or I am missing smth.?

Regards,
Ivan


More information about the LibreOffice mailing list