[Bug 192303] C++11 std::list<>::remove_if() visits elements multiple times

bugzilla-noreply at freebsd.org bugzilla-noreply at freebsd.org
Sat Aug 2 23:37:58 UTC 2014


https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=192303

--- Comment #3 from kamikaze at bsdforen.de ---
Created attachment 145275
  --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=145275&action=edit
Proposed fix

The issue is an optimisation in the implementation. If __pred(*__i) returns
true, the method goes into an inner loop that looks for subsequent items to
delete in the list for cumulative deletion.

After performing deletion the iterator will point to the first item behind the
deleted items. Which has already been visited (returning false ended the inner
loop).

The proposed patch points the iterator past this list entry - unless the
iterator points to the end of the list.

-- 
You are receiving this mail because:
You are the assignee for the bug.


More information about the freebsd-bugs mailing list