Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 02 Aug 2014 23:37:58 +0000
From:      bugzilla-noreply@freebsd.org
To:        freebsd-bugs@FreeBSD.org
Subject:   [Bug 192303] C++11 std::list<>::remove_if() visits elements multiple times
Message-ID:  <bug-192303-8-1FaDFN5RH7@https.bugs.freebsd.org/bugzilla/>
In-Reply-To: <bug-192303-8@https.bugs.freebsd.org/bugzilla/>
References:  <bug-192303-8@https.bugs.freebsd.org/bugzilla/>

next in thread | previous in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=192303

--- Comment #3 from kamikaze@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.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-192303-8-1FaDFN5RH7>