Skip to content

Commit

Permalink
MINOR: [C++] Use remove_if
Browse files Browse the repository at this point in the history
Quick follow up to apache#12891

Closes apache#12949 from lidavidm/arrow-12659

Authored-by: David Li <[email protected]>
Signed-off-by: Yibo Cai <[email protected]>
  • Loading branch information
lidavidm authored and cyb70289 committed Apr 24, 2022
1 parent c68ec54 commit 0b06870
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions cpp/src/arrow/util/vector.h
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,8 @@ std::vector<T> ReplaceVectorElement(const std::vector<T>& values, size_t index,

template <typename T, typename Predicate>
std::vector<T> FilterVector(std::vector<T> values, Predicate&& predicate) {
auto new_end = std::stable_partition(values.begin(), values.end(),
std::forward<Predicate>(predicate));
auto new_end = std::remove_if(values.begin(), values.end(),
[&](const T& value) { return !predicate(value); });
values.erase(new_end, values.end());
return values;
}
Expand Down

0 comments on commit 0b06870

Please sign in to comment.