Remove implicit hstring constructor for string_view#1529
Remove implicit hstring constructor for string_view#1529justanotheranonymoususer wants to merge 3 commits intomicrosoft:masterfrom
Conversation
|
While I agree with the intent here, this is source breaking so unlikely to get merged. I'm also not sure what's even the point of an overload taking an explicit size parameter. A constructor that takes in an explicit size suggests that the string doesn't need to be null-terminated, just like If a source-breaking change was possible, I'd just completely eliminate this overload. For now, I'd go with the suggestion from @DefaultRyan here to update |
I don't know the extent, but as I explained, it's likely incorrect and a UB, which is not good to have in a library. If it has extensive usage, perhaps it can be deprecated instead. LMK.
I added it to assist migration. I agree that it should also be documented to make absolutely clear that the requirement is that
Well, it's not only that, example: unbox_value_or(boxed, ReturnsStringView()); |
| { | ||
| } | ||
|
|
||
| hstring(std::wstring_view const& value) noexcept |
There was a problem hiding this comment.
This is too much of a breaking source change to take at this point. I'd suggest adding it to the list of v3 features under consideration on #1123
|
Would you agree to make it
https://en.cppreference.com/w/cpp/language/attributes/deprecated ?
…On Thu, Jan 8, 2026 at 9:21 PM Ryan Shepherd ***@***.***> wrote:
***@***.**** requested changes on this pull request.
------------------------------
In strings/base_string_input.h
<#1529 (comment)>:
> @@ -18,11 +18,6 @@ WINRT_EXPORT namespace winrt::param
{
}
- hstring(std::wstring_view const& value) noexcept
This is too much of a breaking source change to take at this point. I'd
suggest adding it to the list of v3 features under consideration on #1123
<#1123>
—
Reply to this email directly, view it on GitHub
<#1529 (review)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABMDRPEW3NHONMQM5QMSZM34F2U45AVCNFSM6AAAAACQ6EBF3SVHI2DSMVQWIX3LMV43YUDVNRWFEZLROVSXG5CSMV3GSZLXHMZTMNBQHEYDIMZYHA>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
|
The maintainers don't seem to consider using [[deprecated]], as seen at #1244. Honestly, I think even with v3, C++/WinRT needs to implement its own null-terminated string view, because C++29 will be the earliest version to have it, and raising C++/WinRT's minimum standard to C++29 would happen after v3 is released. |
|
This pull request is stale because it has been open 10 days with no activity. Remove stale label or comment or this will be closed in 5 days. |
|
Waiting for reply
…On Tue, Jan 20, 2026, 02:35 github-actions[bot] ***@***.***> wrote:
*github-actions[bot]* left a comment (microsoft/cppwinrt#1529)
<#1529 (comment)>
This pull request is stale because it has been open 10 days with no
activity. Remove stale label or comment or this will be closed in 5 days.
—
Reply to this email directly, view it on GitHub
<#1529 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABMDRPHSCZ22K6DFMWXCZAL4HVZ5TAVCNFSM6AAAAACQ6EBF3SVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZTONZQGU2DONJVG4>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
|
This pull request is stale because it has been open 10 days with no activity. Remove stale label or comment or this will be closed in 5 days. |
|
Keepalive
…On Thu, Feb 5, 2026, 02:08 github-actions[bot] ***@***.***> wrote:
*github-actions[bot]* left a comment (microsoft/cppwinrt#1529)
<#1529 (comment)>
This pull request is stale because it has been open 10 days with no
activity. Remove stale label or comment or this will be closed in 5 days.
—
Reply to this email directly, view it on GitHub
<#1529 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABMDRPC3W44PA3V6SB4UEN34KKCXFAVCNFSM6AAAAACQ6EBF3SVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZTQNJQGM2TONZUGY>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
Fixes #1527
In C++,
string_viewhas no notion of a null terminator, which is assumed bycreate_string_reference.