On Thu, Aug 15, 2002 at 09:23:51AM +0200, Lars Gullik Bjønnes wrote:
> |         if (!locked) {
> | -               Paragraph * p = &*(paragraphs.begin());
> | -               while (p->next())
> | -                       p = p->next();
> | +               Paragraph * p = &*(boost::prior(paragraphs.end()));
> 
> and this is buggy now so it has to change. (where did you find it?)

In the .4 patch. I realize that this is not the newst, but that's where I
started reading yesterday.

> | Coulnd't that be solved by having a back() method on ParagraphsList?
> 
>         Actually I like it solved by either:
> 
>         Paragraph * p = &*boost::prior(paragraphs.end()); 
>         (the ParagraphList::iterator for end is too dumb for this)
>         or
> 
>         Paragraph * p = &paragraphs.back();
>         (easy to add, but will be O(n) until we move to a real STL
>         container)

Why? It's guranteed O(1) for std::list

Andre'

-- 
Those who desire to give up Freedom in order to gain Security,
will not have, nor do they deserve, either one. (T. Jefferson)

Reply via email to