lidavidm commented on code in PR #12891:
URL: https://github.com/apache/arrow/pull/12891#discussion_r855375741


##########
cpp/src/arrow/util/vector.h:
##########
@@ -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::remove_if(values.begin(), values.end(), 
std::forward<Predicate>(predicate));
+  auto new_end = std::stable_partition(values.begin(), values.end(),

Review Comment:
   We want `keep_if` not `remove_if` though I suppose we could wrap `predicate` 
and invert it.



##########
cpp/src/arrow/util/vector.h:
##########
@@ -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::remove_if(values.begin(), values.end(), 
std::forward<Predicate>(predicate));
+  auto new_end = std::stable_partition(values.begin(), values.end(),

Review Comment:
   We want a (hypothetical) `keep_if` not `remove_if` though I suppose we could 
wrap `predicate` and invert it.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to