Date: prev next · Thread: first prev next last
2013 Archives by date, by thread · List index


Hi Julien,

julien2412 píše v So 21. 09. 2013 v 03:55 -0700:

I noticed some weird things in SwTable::CheckConsistency(), eg:
   2102     std::list< RowSpanCheck > aRowSpanCells;
   2103     std::list< RowSpanCheck >::iterator aIter = aRowSpanCells.end();

then I see ++aIter several times some lines later.
How can it work since:
aRowSpanCells isn't initialized
aIter is at the end of aRowSpanCells
?

The code is curious, so I'll just quickly answer without studying it
deeply :-) - I guess during the first pass the ++aIter is not accessed
at all.  Then at the end of the 1st pass, it is initialized (aIter =
aRowSpanCells.begin(); at the end), and the we can do ++aIter as we
want...

Just nitpicking but I think that this part:
   2128                     std::list< RowSpanCheck >::iterator aEraseIter =
aIter;
   2129                     ++aIter;
   2130                     aRowSpanCells.erase( aEraseIter );
could be replaced by:
aIter = aRowSpanCells.erase(aIter);
since "erase "returns an iterator even before C++11 standard (see
http://www.cplusplus.com/reference/list/list/erase/)

Could work - but as I did not look well enough at this code, please
don't take it as 'go ahead & clean it up' :-) - some checking of the
history of that file could give you more clues about that I guess.

Thanks for looking into this!

All the best,
Kendy


Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.