-
-
Notifications
You must be signed in to change notification settings - Fork 412
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
etl::remove_if calls predicate twice for first iterator, where predicate returns true. #815
Comments
It seems the algorithm works fine without the initial |
@jwellbelove Please consider using something similar to the possible implementation on cppreference: https://en.cppreference.com/w/cpp/algorithm/remove |
Thanks, I'll take a look at that. |
I went back to the original implementation and just moved the increment.
|
Fixed 20.38.12 |
See code below.
etl::find_if
returns the first iterator, wherepredicate
returns true. So iffirst != last
, predicate is already called for*first
. However,itr = first
andif (!predicate(*itr))
callspredicate
again for*first
.In our code, we have logging for when an item in the iterator has been marked for removal. Resulting in logging this twice for the first element that is marked for removal.
The text was updated successfully, but these errors were encountered: