Skip to content

box_value constructor: Replace param::hstring with hstring - #1530

Merged
Ryan Shepherd (DefaultRyan) merged 6 commits into
microsoft:masterfrom
justanotheranonymoususer:box-
Apr 1, 2026
Merged

box_value constructor: Replace param::hstring with hstring#1530
Ryan Shepherd (DefaultRyan) merged 6 commits into
microsoft:masterfrom
justanotheranonymoususer:box-

Conversation

@justanotheranonymoususer

Copy link
Copy Markdown
Contributor

Partial fix for #1527.

Other places remain unfixed, example:

unbox_value_or(boxed, ReturnsStringView());

Or any other param::hstring usage.

@github-actions

This comment was marked as resolved.

@justanotheranonymoususer

This comment was marked as resolved.

@github-actions

This comment was marked as resolved.

@justanotheranonymoususer

This comment was marked as resolved.

@github-actions

This comment was marked as resolved.

@justanotheranonymoususer

This comment was marked as resolved.

@github-actions

This comment was marked as resolved.

@sylveon

Copy link
Copy Markdown
Contributor

Ryan Shepherd (@DefaultRyan) This PR is a good one - box_value will always do a copy of the hstring so we might as well skip the param::hstring here.

@DefaultRyan

Copy link
Copy Markdown
Member

This breaks boxing of string-like types such as std::wstring and std::wstring_view via conversion to param::hstring.

I think we can still do this with a little more finesse. One idea of the top of my head is to have an exact hstring overload, and an overload for string-like types that are convertible to param::hstring. For the second overload, we don't actually create a param::hstring, but explicitly construct a fully-fledged hstring instead.

@justanotheranonymoususer

Copy link
Copy Markdown
ContributorAuthor

I tried to fix, can you run tests?

@DefaultRyan

Copy link
Copy Markdown
Member

I tried to fix, can you run tests?

Did you know you can run the tests locally? That break would have been caught there and saved you some time. :)

@justanotheranonymoususer

Copy link
Copy Markdown
ContributorAuthor

I was filling lucky. Should pass now, and I even added tests.

@justanotheranonymoususer

Copy link
Copy Markdown
ContributorAuthor

Ryan Shepherd (@DefaultRyan) it's green now, are we good?

@justanotheranonymoususer

Copy link
Copy Markdown
ContributorAuthor

thx for approving, can you also merge?

@DefaultRyan
Ryan Shepherd (DefaultRyan) merged commit 3893ce8 into microsoft:masterApr 1, 2026
82 checks passed
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants

@justanotheranonymoususer@sylveon@DefaultRyan@StephanTLavavej