← Back to team overview

team-karma team mailing list archive

[Bug 398628] Re: List function erase is dangerous

 

The code is now fixed according to this wish list.

** Changed in: project-karma
       Status: Confirmed => Fix Committed

-- 
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: Fix Committed

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