[MS] The Windows Runtime winrt::hstring and the C++ std::wstring are inter-assignable - devamazonaws.blogspot.com
For the past few days, I've been talking about converting between various string types while avoiding data loss and security issues if an embedded null is present. But in the case where you are dealing with winrt::
and std::
, the story is much simpler.
The winrt::
and std::
types can simply be assigned to each other. No need to do funny wstring_view
or c_str()
nonsense.
winrt::hstring h; std::wstring s; h = s; // this works! s = h; // this also works!
The assignments work because winrt::
and std::
both support assignment from std::
, and both winrt::
and std::
are convertible to std::
.
Post Updated on June 21, 2024 at 03:00PM
Thanks for reading
from devamazonaws.blogspot.com
Comments
Post a Comment