team-karma team mailing list archive
-
team-karma team
-
Mailing list archive
-
Message #00006
[Bug 398628] Re: List function erase is dangerous
** Changed in: project-karma
Importance: Undecided => Wishlist
** Changed in: project-karma
Status: New => Confirmed
** Changed in: project-karma
Assignee: (unassigned) => H. L. Prasad (hlprasu)
--
List function erase is dangerous
https://bugs.launchpad.net/bugs/398628
You received this bug notification because you are a member of कर्म,
which is the registrant for कर्म.
Status in Karma - Dynamic Systems Modelling, Simulation and Control: Confirmed
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)
References