Add literal operators, factory functions, and tests for primitives#20
Merged
FrozenLemonTee merged 14 commits intomainfrom Mar 27, 2026
Merged
Add literal operators, factory functions, and tests for primitives#20FrozenLemonTee merged 14 commits intomainfrom
FrozenLemonTee merged 14 commits intomainfrom
Conversation
…h range checks Signed-off-by: FrozenlemonTee <1115306170@qq.com>
Signed-off-by: FrozenlemonTee <1115306170@qq.com>
…nctionality Signed-off-by: FrozenlemonTee <1115306170@qq.com>
…upport Signed-off-by: FrozenlemonTee <1115306170@qq.com>
Signed-off-by: FrozenlemonTee <1115306170@qq.com>
…ive aliases Signed-off-by: FrozenlemonTee <1115306170@qq.com>
Signed-off-by: FrozenlemonTee <1115306170@qq.com>
Signed-off-by: FrozenlemonTee <1115306170@qq.com>
Signed-off-by: FrozenlemonTee <1115306170@qq.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds user-defined literal operators for common underlying types and introduces with(...) factory helpers plus Size/Diff primitive aliases, with basic tests to validate the new APIs.
Changes:
- Add
mcpplibs::primitives::literalsuser-defined literals for integral, floating, and character underlying types. - Add
with(...)primitive factory functions (including a policies-tuple overload) andtypes::Size/types::Diffaliases. - Add basic test coverage for both literals and the
with(...)factory behavior.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| tests/basic/underlying/literals/test_literals.cpp | Adds tests validating literal operator return types and values. |
| tests/basic/primitive/factory/test_make_primitive.cpp | Adds tests for with(...) factory helpers, default policies, tuple-policies overload, and new Size/Diff aliases. |
| src/underlying/impl.cppm | Implements exported literal operators and compile-time range checks for casts. |
| src/primitive/traits.cppm | Refactors make_primitive into meta::details and keeps make_primitive_t as the exported alias. |
| src/primitive/impl.cppm | Adds with(...) factory functions and types::Size / types::Diff primitive aliases. |
…terals module Signed-off-by: FrozenlemonTee <1115306170@qq.com>
Signed-off-by: FrozenlemonTee <1115306170@qq.com>
…robes Signed-off-by: FrozenlemonTee <1115306170@qq.com>
…nd precision validation Signed-off-by: FrozenlemonTee <1115306170@qq.com>
…istency Signed-off-by: FrozenlemonTee <1115306170@qq.com>
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.