[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kfm-devel
Subject:    Re: khtml / kaccel crash
From:       Koos Vriezen <koos.vriezen () xs4all ! nl>
Date:       2002-02-12 20:54:21
[Download RAW message or body]

On Tue, 12 Feb 2002, David Faure wrote:
> On Tuesday 12 February 2002 20:45, Koos Vriezen wrote:
> > > I don't trust this iterator not to go before m_mapKeyToAction.begin()
> >
> > I attached a small patch for it. It seems to work. Not very nice though,
> > QMap doesn't have find function with predicate functions.
> > But we can watch frames again ;-).
>
> Thanks for the patch.
> Looks good, committed (with additional comments so that Ellis
> isn't too lost at what this is doing ;)
>
> Removing elements from a QMap in a loop doesn't look so easy...

In STL there is a remove_if(it_begin, it_end, pred) where pred is a
function object where you can do your things and return true if the item
should be removed.
You also don't get such an ugly 'for' loop and encourages code reuse. OTOH
all necesary stuf must be provided to the function object's constructor.

Koos

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic