Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR enhances the variant implementation to handle CV-qualified types as arguments to variant operations. The primary goal is to allow the variant to work correctly with const/volatile qualified types in both storage and access operations.
Key Changes
- Enhanced variant template argument handling to support CV-qualified types
- Added comprehensive test coverage for CV-qualified variants and reference-based get operations
- Improved type deduction for variant assignment operations
Reviewed Changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 8 comments.
Show a summary per file
| File | Description |
|---|---|
include/rsl/variant |
Core variant implementation updates for CV type handling, assignment operators, and storage generation |
test/variant/variant.get/get.cpp |
Comprehensive test implementation for variant get operations with CV-qualified types |
test/variant/variant.assign/assign.cpp |
New test file for variant assignment operations |
test/variant/variant.ctor/default.cpp |
Additional constructor tests for CV-qualified variants |
| Multiple CMakeLists.txt | Build configuration updates to include new test files |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
9de884d to
29ba90e
Compare
include/rsl/variant
Outdated
| define_aggregate(^^Storage, | ||
| {data_member_spec(^^char, {.name="_rsl_dummy"}), | ||
| data_member_spec(^^Ts, {.name= "_rsl_alt" + util::to_string(idx++)})... | ||
| data_member_spec(std::meta::remove_cv(^^Ts), {.name= "_rsl_alt" + util::to_string(idx++)})... |
There was a problem hiding this comment.
do not spell out std::meta:: here. remove_cv can be found via ADL - the argument is of type std::meta::info. Please apply this change to tagged_variant::make_storage as well.
There was a problem hiding this comment.
Also I can't help but wonder if remove_cvref is better here. Union members cannot be references - so variant<T&> is rejected either way. Might be worth it to make extra sure it cannot possibly fail at this point.
29ba90e to
774efb1
Compare
Closes #19
Will make it a draft since requires rebase on top of #18