[Webkit-unassigned] [Bug 71063] HashMap<>::add should return a more descriptive object

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Fri Jan 6 16:45:39 PST 2012


https://bugs.webkit.org/show_bug.cgi?id=71063





--- Comment #2 from Ryosuke Niwa <rniwa at webkit.org>  2012-01-06 16:45:38 PST ---
(In reply to comment #1)
> (In reply to comment #0)
> > We end up code like:
> > 
> > pair<EventListenerHashMap::iterator, bool> result = m_hashMap->add(eventType, 0);
> > if (result.second)
> >     result.first->second = new EventListenerVector;
> 
> What about have the following?
> 
> EventListenerHashMap::AddResult result = m_hashMap->add(eventType, 0);
> if (result.isNewKey)
>     result.iterator->second = new EventListenerVector;

Yes, that'll be an improvement. We should probably improve the interface of iterator as well so that it'll be something like:

if (result.isNewKey)
    result.iterator->value = new EventListenerVector;

-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.



More information about the webkit-unassigned mailing list