microsoft / wil

Windows Implementation Library

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

wil::zwstring_view should have a constructor that takes a winrt::hstring

dmachaj opened this issue · comments

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.