wil::zwstring_view should have a constructor that takes a winrt::hstring
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 3k
- Forks
- 300
- Avg merge
- 19h 12m
- Merged PRs (30d)
- 1
Description
When cppwinrt string types are being used wil::zwstring_view is unfortunately not a drop-in replacement for std::wstring_view. There is no conversion operator from winrt::hstring to wil::zwstring_view so compilation fails.
This can be manually worked around by in-place constructing a wil::zwstring_view with the c_str() and .size() values from winrt::hstring. That is ugly, though. It would be better if it was automatic.
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 by locating the definition of wil::zwstring_view and its constructors, then inspect how winrt::hstring exposes c_str() and size(). Add the requested conversion path so an hstring can be used directly as a zwstring_view, and verify that the original manual c_str()/size() workaround is no longer needed in a compiling example or test.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- tooling
- Issue type
- Feature
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 55/100