Add Function and MutatingFunction type-erased callable wrappers#79
Draft
Add Function and MutatingFunction type-erased callable wrappers#79
Conversation
Agent-Logs-Url: https://github.com/jbcoe/cc-protocol/sessions/38ec5553-7c97-4df9-a770-67b5b6cb0252 Co-authored-by: jbcoe <777363+jbcoe@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Implement type-erased types similar to std::function
Add Function and MutatingFunction type-erased callable wrappers
Apr 20, 2026
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.
DRAFT.mddescribes howprotocol/protocol_viewcan implement the standard library's callable wrappers. This PR adds the concrete interface headers and tests that demonstrate this.New interfaces
interface_function.h—struct Function { int operator()(int) const; }— modelsstd::copyable_function<int(int) const>interface_mutating_function.h—struct MutatingFunction { int operator()(int); }— modelsstd::copyable_function<int(int)>std::copyable_function<int(int) const>protocol<Function>std::function_ref<int(int) const>protocol_view<const Function>std::copyable_function<int(int)>protocol<MutatingFunction>std::function_ref<int(int)>protocol_view<MutatingFunction>Template bug fix
protocol.j2andprotocol_manual_vtable.j2generatedrequires(const T& t) {}when an interface has noconstmethods — an empty requires-expression that GCC 13 rejects. The const concept now emitstruein that case.