feat(Variant): add FromValue/ToValue helpers#219
Merged
Conversation
Contributor
Author
|
I'll take a look at Resolving from RedLib, and write a dedicated PR. |
wopss
reviewed
May 30, 2026
wopss
requested changes
May 30, 2026
Implementation is already using only `const` methods.
Convert a Variant to/from a value. Support fundamental and common types.
Call is more elegant to use but the end-user can't check for an error at the same time.
- `ToValue` returns `std::nullopt` when value's type is unsupported - `FromValue` returns `Variant` directly, user can call `IsEmpty` to check for an error/unsupported type.
36f269a to
d990a80
Compare
psiberx
approved these changes
Jun 1, 2026
Contributor
Author
|
I'll update CHANGELOG and I guess it will be ready to merge? |
Owner
|
Yes. |
wopss
reviewed
Jun 1, 2026
Include concept `IsNotIType` after `rtti::IType` definition for common usage.
wopss
reviewed
Jun 2, 2026
2b32bcb to
4189bb6
Compare
psiberx
reviewed
Jun 2, 2026
wopss
reviewed
Jun 7, 2026
wopss
approved these changes
Jun 7, 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.
Changes
Variantto/from a value. Support fundamental and common types.Extractmethod, implementation is already readonly.Usages
Static:
Static without direct error feedback:
Set/Get directly on an instance:
Notes
This is a first step. In the end, integrating implementation from RedLib would likely be the best solution for end-users. I left a comment about this.