On Thu, Nov 10, 2005 at 03:28:42PM +0200, Martin Vermeer wrote: > On Wed, 2005-11-09 at 14:17 +0100, Jean-Marc Lasgouttes wrote: > > >>>>> "Martin" == Martin Vermeer <[EMAIL PROTECTED]> writes: > > > > Martin> So then the original patch should go in, with break added? How > > Martin> expensive is this with big documents? It scales linearly. > > > > The good thing is that we have really reduce the number of times > > getFont gets called. Nevertheless, the maybe quadratic in some cases, > > since getFont is called at least once per paragraph. > > > > The right solution would be to pass a DocIterator or a pit/pos pair to > > getFont, but this is probably a lot of work. > > > > JMarc > > So... can this go in?
+ pit_type pit = pars_.size(); + for (pit_type it = 0; it < pars_.size(); ++it) { + if (&pars_[it] == &par) { + pit = it; + break; + } + } I just wonder whether + pit_type pit = 0; + for ( ; pit < pars_.size(); ++pit) + if (&pars_[pit] == &par) + break; or even + pit_type pit = 0; + for ( ; pit < pars_.size() && &pars_[pit] != ∥ ++pit) + ; wouldn't achieve the same. Andre'