RESOLVED FIXED 59151
Provide default constructors for HashMap iterators
https://bugs.webkit.org/show_bug.cgi?id=59151
Summary Provide default constructors for HashMap iterators
Vitaly Repeshko
Reported 2011-04-21 16:07:27 PDT
[WTF] Provide default constructors for HashMap iterators
Attachments
patch (1.61 KB, patch)
2011-04-21 16:14 PDT, Vitaly Repeshko
abarth: review+
Vitaly Repeshko
Comment 1 2011-04-21 16:14:44 PDT
Adam Barth
Comment 2 2011-04-21 16:30:05 PDT
Comment on attachment 90625 [details] patch View in context: https://bugs.webkit.org/attachment.cgi?id=90625&action=review > Source/JavaScriptCore/wtf/HashTable.h:1123 > + HashTableConstIteratorAdapter() {} Do we need to initialize m_impl to anything (like null) or does it do that itself?
Adam Barth
Comment 3 2011-04-21 16:30:18 PDT
+mjs for WTF foo.
Vitaly Repeshko
Comment 4 2011-04-21 16:32:12 PDT
(In reply to comment #2) > (From update of attachment 90625 [details]) > View in context: https://bugs.webkit.org/attachment.cgi?id=90625&action=review > > > Source/JavaScriptCore/wtf/HashTable.h:1123 > > + HashTableConstIteratorAdapter() {} > > Do we need to initialize m_impl to anything (like null) or does it do that itself? Unlike the adapter it has a default constructor. So I don't think it should be initialized.
Sam Weinig
Comment 5 2011-04-21 19:56:48 PDT
Why are these needed? What will they be used for?
Vitaly Repeshko
Comment 6 2011-04-21 20:16:46 PDT
(In reply to comment #5) > Why are these needed? What will they be used for? Right now you can't declare a variable or class field of type HashMap::iterator without immediately initializing it. This is inconsistent with wtf::Vector and STL iterators. My specific intended usage for them is to implement a lightweight iterator over EventTarget's listeners. EventTarget has a map of vectors. So the listener iterator simply combines a map iterator and an index. The problem is that the listener map is optional and the map iterator can't be initialized when it's NULL without using some dummy map.
Adam Barth
Comment 7 2011-04-21 22:11:37 PDT
I asked Vitaly to post this as a separate patch because the folks who would review this patch might not be the same folks who would be interested in reviewing the rest of his change.
Adam Barth
Comment 8 2011-04-22 09:02:41 PDT
Comment on attachment 90625 [details] patch View in context: https://bugs.webkit.org/attachment.cgi?id=90625&action=review > Source/JavaScriptCore/ChangeLog:7 > + I would add some more explanation here about why you're making this change (i.e., that you plan to use it in another patch shortly).
Vitaly Repeshko
Comment 9 2011-04-22 15:01:40 PDT
M Source/JavaScriptCore/ChangeLog M Source/JavaScriptCore/wtf/HashTable.h Committed r84687
Note You need to log in before you can comment on or make changes to this bug.