Closed
Bug 1166157
Opened 10 years ago
Closed 10 years ago
Implement enumerating method for nsTArray which allows removing element
Categories
(Core :: XPCOM, defect)
Core
XPCOM
Tracking
()
RESOLVED
INVALID
| Tracking | Status | |
|---|---|---|
| firefox41 | --- | affected |
People
(Reporter: xidorn, Unassigned)
Details
Attachments
(1 file)
|
4.20 KB,
patch
|
Details | Diff | Splinter Review |
We should have an enumerating method for nsTArray like nsTHashtable::EnumerateEntries, which allows removing elements.
A bonus would be that we could do it with lambda, so that we don't need to use a "void* aUserArg" hack.
| Reporter | ||
Comment 1•10 years ago
|
||
Attachment #8607345 -
Flags: review?(nfroyd)
Comment 2•10 years ago
|
||
Comment on attachment 8607345 [details] [diff] [review]
patch
Review of attachment 8607345 [details] [diff] [review]:
-----------------------------------------------------------------
Why not change the iterator returned by begin()/end()/etc. to be stable in the face of removals?
Attachment #8607345 -
Flags: review?(nfroyd)
| Reporter | ||
Comment 3•10 years ago
|
||
To make the iterator removal-stable, we would have to either accept a terrible O(n) time for each removal, or add burden to normal iterating which doesn't need to remove elements.
I guess the first opinion is probably fine, as we probably won't usually do removal that frequently.
| Reporter | ||
Comment 4•10 years ago
|
||
It's probably tricky to make iterator support removal, especially consider that the direction of an iterator can be reversed.
Probably we could just use std::remove_if.
| Reporter | ||
Updated•10 years ago
|
Status: NEW → RESOLVED
Closed: 10 years ago
Resolution: --- → INVALID
You need to log in
before you can comment on or make changes to this bug.
Description
•