Skip to content

Extract type handler common rep#6

Merged
FrozenLemonTee merged 9 commits intomainfrom
extract-type-handler-common-rep
Mar 18, 2026
Merged

Extract type handler common rep#6
FrozenLemonTee merged 9 commits intomainfrom
extract-type-handler-common-rep

Conversation

@FrozenLemonTee
Copy link
Member

No description provided.

Copilot AI review requested due to automatic review settings March 18, 2026 06:46
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR introduces an extensible “common representation” negotiation mechanism for mixed-representation operations, shifting type-handler common-rep selection from hardcoded std::common_type_t to customizable underlying traits, and updates tests/examples accordingly.

Changes:

  • Add underlying::common_rep_traits + exported has_common_rep / common_rep_t APIs (defaulting to std::common_type_t when available).
  • Update type policy handlers (compatible/transparent) to gate on has_common_rep and use common_rep_t.
  • Add tests and example updates demonstrating default/common-rep customization and improve example file headers.

Reviewed changes

Copilot reviewed 14 out of 14 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
src/underlying/traits.cppm Adds common_rep_traits and exports has_common_rep / common_rep_t.
src/policy/impl.cppm Updates type handlers to require has_common_rep and use common_rep_t.
src/primitive/traits.cppm Refines module imports to submodules (policy.*, underlying.traits).
src/primitive/impl.cppm Refines module imports to submodules (policy.traits, underlying.traits).
tests/basic/test_templates.cpp Adds common-rep default/customization assertions and handler checks.
tests/basic/test_operations.cpp Formatting adjustments; updates expectation for common_rep when disallowed.
examples/ex01_default_arithmetic.cpp Adds example header comment block.
examples/ex02_type_policy.cpp Adds example header comment block.
examples/ex03_value_policy.cpp Adds example header comment block.
examples/ex04_error_policy.cpp Adds example header comment block.
examples/ex05_concurrency_policy.cpp Adds example header comment block.
examples/ex06_custom_underlying.cpp Demonstrates custom common_rep_traits negotiation (plus header/docs).
examples/ex07_custom_policy.cpp Adds example header comment block.
examples/ex08_custom_operation.cpp Adds example header comment block.

You can also share your feedback on Copilot code review. Take the survey.

@FrozenLemonTee FrozenLemonTee merged commit 34c19a8 into main Mar 18, 2026
3 checks passed
@FrozenLemonTee FrozenLemonTee deleted the extract-type-handler-common-rep branch March 18, 2026 14:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants