cleanup: replace erase-remove idiom with std::erase_if or absl::erase_if - #46663
Open
Amila-Rukshan wants to merge 1 commit into
Open
cleanup: replace erase-remove idiom with std::erase_if or absl::erase_if#46663Amila-Rukshan wants to merge 1 commit into
Amila-Rukshan wants to merge 1 commit into
Conversation
Amila-Rukshan
requested review from
RyanTheOptimist,
agrawroh,
botengyao,
mattklein123,
ravenblackx and
yanavlasov
as code owners
August 12, 2026 09:23
Amila-Rukshan
force-pushed
the
improve-readability
branch
from
August 12, 2026 09:33
e5cf083 to
06a37f8
Compare
…ve idiom Signed-off-by: Amila Senadheera <amilaruk1995@gmail.com>
Amila-Rukshan
force-pushed
the
improve-readability
branch
from
August 12, 2026 10:26
06a37f8 to
c82105c
Compare
Contributor
Author
|
/retest |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Replace the traditional erase-remove idiom with the more concise
std::erase_ifandabsl::erase_ifAPIs where applicable.This improves readability by expressing the intent to remove elements matching a predicate directly, while preserving the existing behavior.
Changes
Replace
std::remove_iffollowed byerasewithstd::erase_iffor standard containers.Replace the same pattern with
absl::erase_iffor supported Abseil containers.No functional behavior changes are intended.