Conversation
|
@DefaultRyan I tried using |
|
An approach I've taken elsewhere is to conditionally define the char type using the |
|
/azp run |
|
No pipelines are associated with this pull request. |
|
/azp run |
|
No pipelines are associated with this pull request. |
|
@kennykerr looks like you're doing changes from a different machine or the git config doesn't contain the mail associated with your account. @walbourn Since all processes which share a library have separate memory they can store a flag to indicate does the current process uses UTF-8 or UTF-16. So if an app has UTF-8 strings, then there should be no conversion. Otherwise, conversion is required. Near the same way In case of WinRT where strings represented as handles and where the string lifetime is controlled by a reference counter, RAII could help: |
DefaultRyan
left a comment
There was a problem hiding this comment.
Left a couple recommendations, but nothing I want to block over.
| template <size_t Size> | ||
| hstring literal_to_hstring(std::array<char_type, Size> const& value) noexcept | ||
| { | ||
| return to_hstring(std::string_view(reinterpret_cast<char const*>(value.data()), Size - 1)); |
There was a problem hiding this comment.
Recommend adding an overload of to_hstring for std::u8string_view, which will reduce developer friction if when they use char8_t strings. Then, the reinterpret_cast can live there, as its only purpose is to translate from char8_t to the char required by MultiByteToWideChar.
There was a problem hiding this comment.
Yeah, I was hoping to use u8string_view but it looks like its new to C++20.
There was a problem hiding this comment.
u8string_view is C++to, but basic_string_view<winrt::impl::char_type> always works.
| REQUIRE(winrt::name_of<winrt_container>() == midl_container::z_get_rc_name_impl()); | ||
|
|
||
| constexpr auto name = winrt::name_of<winrt::guid>(); | ||
| auto name = winrt::name_of<winrt::guid>(); |
There was a problem hiding this comment.
The change makes this not really a constexpr test any more. Shouldn't this test still be using name_v and comparing it to u8"Guid"?
There was a problem hiding this comment.
Yeah I should just remove this test.
This reverts commit 08eca8b.
Part of #607 to store runtime names in binaries using utf-8 rather than utf-16.
The next step is to fold common prefixes to reduce binary size even further.