kszucs opened a new issue, #45816: URL: https://github.com/apache/arrow/issues/45816
### Describe the enhancement requested I was trying to use VisitType with a closure using the constexpr `type_id` based type checkers from `type_traits` in the following fashion: ```cpp auto handle_type = [&](auto&& type) { using Type = std::decay_t<decltype(type)>; if constexpr (::arrow::is_boolean(Type::type_id)) { ... } else if constexpr (::arrow::is_primitive(Type::type_id)) { ... } /* else etc. */ }; return VisitType(*values.type(), handle_type); ``` but got compile errors: ``` /Users/kszucs/Workspace/arrow/cpp/src/parquet/chunker_internal.cc:287:54: error: no member named 'type_id' in 'arrow::DataType' 287 | if constexpr (::arrow::is_primitive(ArrowType::type_id)) { | ^ /Users/kszucs/Workspace/arrow/cpp/src/arrow/visit_type_inline.h:88:10: note: in instantiation of function template specialization 'parquet::internal::ContentDefinedChunker::Impl::GetChunks(const int16_t *, const int16_t *, int64_t, const ::arrow::Array &)::(anonymous class)::operator()<const arrow::DataType &>' requested here 88 | return std::forward<VISITOR>(visitor)(type, std::forward<ARGS>(args)...); | ^ /Users/kszucs/Workspace/arrow/cpp/src/parquet/chunker_internal.cc:299:21: note: in instantiation of function template specialization 'arrow::VisitType<(lambda at /Users/kszucs/Workspace/arrow/cpp/src/parquet/chunker_internal.cc:285:24) &>' requested here 299 | return ::arrow::VisitType(*values.type(), handle_type); | ^ ``` because of the fallback branch (which is also mentioned in the docstrings): https://github.com/apache/arrow/blob/bc0b8585f8807a2e41d7484343cc2e9924c84f51/cpp/src/arrow/visit_type_inline.h#L69-L89 Since the base `DataType` doesn't define `type_id` we cannot use this dispatching pattern with the constexpr type checking functions. ### Component(s) C++ -- 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: issues-unsubscr...@arrow.apache.org.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org