Merged
Conversation
… representation types
There was a problem hiding this comment.
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+ exportedhas_common_rep/common_rep_tAPIs (defaulting tostd::common_type_twhen available). - Update type policy handlers (compatible/transparent) to gate on
has_common_repand usecommon_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.
fix: CI Test
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.
No description provided.