wil::reg::set_value doesn't work with std::wstring values
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 3k
- Forks
- 300
- Avg merge
- 19h 12m
- Merged PRs (30d)
- 1
Description
When you try to call wil::reg::set_value with an std::wstring argument you get a compiler error.
e.g.:
std::wstring my_value = L"Hello";
wil::reg::set_value(HKEY_CURRENT_USER, L"Software\\MyApp", L"MyValue", my_value);
results in:
static_assert failed: 'Unsupported type for set_value_type'
The issue seems to be that reg_view_t::set_value deduces the argument type as const R& value, which will always be the non-const version:
It then passes R to reg_value_type_info::set_value_type<R>, but this expects the const version:
This probably means that all other smart string variants listed there are also affected.
I think the best approach to fix this would be to switch all the affected set_value_type specializations to non-const.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in include/wil/registry_helpers.h, especially reg_view_t::set_value around lines 1182-1187 and the reg_value_type_info::set_value_type specializations around lines 1008-1012. Reproduce the shown std::wstring example, then verify that it and the other listed smart string variants are accepted without the unsupported-type compiler error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- operating-systems
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 52/100