← Back to team overview

team-karma team mailing list archive

[Bug 398628] [NEW] List function erase is dangerous

 

Public bug reported:

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)

** Affects: project-karma
     Importance: Undecided
         Status: New

-- 
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: New

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)



Follow ups

References