GH-50250: [C++] Remove call_traits::argument_type in favor of <type_traits> - #51328
Open
taepper wants to merge 1 commit into
Open
GH-50250: [C++] Remove call_traits::argument_type in favor of <type_traits>#51328taepper wants to merge 1 commit into
call_traits::argument_type in favor of <type_traits>#51328taepper wants to merge 1 commit into
Conversation
pitrou
reviewed
Sep 14, 2026
| std::make_shared<Memoizer>(std::forward<Func>(func), cache_capacity)}; | ||
|
|
||
| return shared_memoized; | ||
| return std::function<RetType(const Key&)>(std::move(shared_memoized)); |
Member
There was a problem hiding this comment.
Wrapping the result in a std::function adds a layer of indirection when calling operator() that might be expensive. Can we avoid this?
Member
|
Unfortunately we'll have to wait for #51326 before we can ensure that this doesn't break on some C++ compilers on our CI platforms. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Rationale for this change
This is the last change for #50250. The remaining
FnOncedoes not have corresponding utilities in the C++20 standard library according to my knowledge.What changes are included in this PR?
This removes the custom meta-programming facility
call_traits::argument_type. We instead use the providedtype_traitsheader which allows us to check invocability (and thus indirectly the argument type) with e.g.std::is_invocable.It needs to be mentioned that none of
std::is_invocable_v,std::invoke_result_t, .. is a drop-in replacement for the removedargument_type. I instead migrated all users of the old facility to the standard constructs. Some call-sites needed changing by supplying template parameters explicitly, but in my opinion all changes are defendable or even improvements.Are these changes tested?
Yes, this refactoring commit still passes all test cases
Are there any user-facing changes?
No
arrow/util/functional.h#50250