Jean-Marc Lasgouttes <[EMAIL PROTECTED]> writes:

| >>>>> "Martin" == Martin Vermeer <[EMAIL PROTECTED]> writes:
| 
| Martin> So... can this go in?
| 
| Since there is a suspicion that the code is going to be slow, it would
| be better to write it to be faster, like (untested):
| 
| +     ParagraphList::const_iterator it = pars_.begin();
| +     ParagraphList::const_iterator const end = pars_.end();
| +     while (it != end && &(*it) != &par)
| +              ++it;
| +

        for (; it != end; ++it)
                if (&(*it) == &par)
                        break;

should not generate any worse code.. and follows the for(...) idom.

but I would prefere

        ParagraphList::const_iterator it =
                find_if(pars_.begin(), pars_.end(), some_functor(par));

        
| +     // Realize against environment font information
| +     if (iit != end)
| +             font.realize(outerFont(pit, pars_));
| +     

        if (it != pars_.end())
                ...;

(or give pars_.end() its own temp var if worried about callind end()
twice.

| Of course, profiling would be interesting too :)

Clearity wins.

-- 
        Lgb

Reply via email to