taepper commented on code in PR #50714:
URL: https://github.com/apache/arrow/pull/50714#discussion_r3676479493


##########
cpp/src/arrow/util/iterator.h:
##########
@@ -520,12 +517,11 @@ struct FilterIterator {
 };
 
 /// \brief Like MapIterator, but where the function can fail or reject 
elements.
-template <
-    typename Fn, typename From = typename 
internal::call_traits::argument_type<0, Fn>,
-    typename Ret = typename internal::call_traits::return_type<Fn>::ValueType,
-    typename To = typename std::tuple_element<0, Ret>::type,
-    typename Enable = typename std::enable_if<std::is_same<
-        typename std::tuple_element<1, Ret>::type, 
FilterIterator::Action>::value>::type>
+template <typename Fn, typename From,
+          typename Ret = typename std::invoke_result_t<Fn&, From>::ValueType,
+          typename To = std::tuple_element_t<0, Ret>,
+          typename Enable = std::enable_if_t<

Review Comment:
   This is a very good point, I fixed this locally:
   
   ```diff
   commit cc9f4df1a0423d67fa61337fb013e11cf71df417 (HEAD -> 
minimize-functional-metaprogramming)
   Author: Alexander Taepper <[email protected]>
   Date:   Wed Jul 29 19:05:30 2026 +0200
   
       replace another `typename Enable` with `requires`
   
   diff --git a/cpp/src/arrow/util/iterator.h b/cpp/src/arrow/util/iterator.h
   index 3a098b1455..1ebdf1bb0c 100644
   --- a/cpp/src/arrow/util/iterator.h
   +++ b/cpp/src/arrow/util/iterator.h
   @@ -518,10 +518,9 @@ struct FilterIterator {
    
    /// \brief Like MapIterator, but where the function can fail or reject 
elements.
    template <typename Fn, typename From,
   -          typename Ret = typename std::invoke_result_t<Fn&, 
From>::ValueType,
   -          typename To = std::tuple_element_t<0, Ret>,
   -          typename Enable = std::enable_if_t<
   -              std::is_same_v<std::tuple_element_t<1, Ret>, 
FilterIterator::Action>>>
   +          typename Ret = std::invoke_result_t<Fn&, From>::ValueType,
   +          typename To = std::tuple_element_t<0, Ret>>
   +  requires std::is_same_v<std::tuple_element_t<1, Ret>, 
FilterIterator::Action>
    Iterator<To> MakeFilterIterator(Fn filter, Iterator<From> it) {
      return Iterator<To>(
          FilterIterator::Impl<Fn, From, To>(std::move(filter), std::move(it)));
   ```
   
   
   Is it okay to push these changes @pitrou ? I can also do this in the second 
part of #50250 instead.



-- 
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