[webkit-reviews] review requested: [Bug 41237] HashSet iterators are quasi-mutable. : [Attachment 59813] Patch
bugzilla-daemon at webkit.org
bugzilla-daemon at webkit.org
Fri Jun 25 17:11:50 PDT 2010
Nathan Lawrence <nlawrence at apple.com> has asked for review:
Bug 41237: HashSet iterators are quasi-mutable.
https://bugs.webkit.org/show_bug.cgi?id=41237
Attachment 59813: Patch
https://bugs.webkit.org/attachment.cgi?id=59813&action=review
------- Additional Comments from Nathan Lawrence <nlawrence at apple.com>
Changing the value through dereferencing an iterator will not change the
behavior of methods like contains or find, but will change the behavior of
iterating. For example, under the current implementation the following code
would print "2, 4, 3" but myHashSet.contains(4) would return false.
HashSet<int> myHashSet;
myHashSet.add(1);
myHashSet.add(2);
myHashSet.add(3);
int& one = myHashSet.find(1);
one = 2;
for (HashSet<int>::iterator i = myHashSet.begin(); i != myHashSet.end(); ++i)
fprintf(stderr, "%u, ", i);
More information about the webkit-reviews
mailing list