List function erase is dangerous
Bug #398628 reported by
Iyer Arvind Sundaram
This bug affects 1 person
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
कर्म |
Fix Committed
|
Wishlist
|
Prasad H L Bhat |
Bug Description
List function erase removes the iterator passed to it. This means any operation of erase in a iterator loop, will immediately cause an error because 'i' would be freed and one would perform 'i++', where i is the iterator. A better solution would be to return the next iterator, so that one can do i=list.erase(i), or take i be reference and increment it (decrement in the case of the last element)
Changed in project-karma: | |
assignee: | nobody → H. L. Prasad (hlprasu) |
importance: | Undecided → Wishlist |
status: | New → Confirmed |
To post a comment you must log in.
The code is now fixed according to this wish list.