bkietz commented on code in PR #14241:
URL: https://github.com/apache/arrow/pull/14241#discussion_r980445728


##########
cpp/src/arrow/visit_type_inline.h:
##########
@@ -57,6 +57,33 @@ inline Status VisitTypeInline(const DataType& type, VISITOR* 
visitor) {
 
 #undef TYPE_VISIT_INLINE
 
+#define TYPE_VISIT_INLINE(TYPE_CLASS)      \
+  case TYPE_CLASS##Type::type_id:          \
+    return std::forward<VISITOR>(visitor)( \
+        internal::checked_cast<const TYPE_CLASS##Type&>(type));
+
+/// \brief Call `visitor` with the corresponding concrete type class
+///
+/// Unlike VisitTypeInline which calls `visitor.Visit`, here `visitor`
+/// itself is called.
+/// `visitor` must support a `const DataType&` argument as a fallback,
+/// in addition to concrete type classes.
+///
+/// The intent is for this to be called on a generic lambda
+/// that may internally use `if constexpr` or similar constructs.
+template <typename VISITOR>
+inline auto VisitType(const DataType& type, VISITOR&& visitor)

Review Comment:
   LGTM



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