Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

C++20: use view() instead of str() to avoid a copy, use starts_with #13218

Merged
merged 8 commits into from
May 14, 2024

Conversation

servusdei2018
Copy link
Contributor

@servusdei2018 servusdei2018 commented May 11, 2024

Description

Use view() instead of str(), starts_with() instead of _Starts_with().

Why

Resolves two TODO items

What

One instance of a str() invocation was replaced with view(), avoiding an unnecessary copy. Additionally, the private function _Starts_with() was replaced with C++20's starts_with().

Changelog

Should this change be included in the release notes: no

Microsoft Reviewers: Open in CodeFlow

@servusdei2018 servusdei2018 requested a review from a team as a code owner May 11, 2024 01:53
@marlenecota
Copy link
Contributor

@servusdei2018 - please run yarn format and push those changes :)

@servusdei2018
Copy link
Contributor Author

Hm I tried running yarn format but git doesn't register any changes:

react-native-windows$ yarn format
yarn run v1.22.22
$ format-files -i -style=file


ran clang-format on 1119 files
Done in 3.35s.
react-native-windows$ git status
On branch servusdei2018-patch-1
Your branch is up to date with 'origin/servusdei2018-patch-1'.

nothing to commit, working tree clean

package.json Outdated Show resolved Hide resolved
@microsoft-github-policy-service microsoft-github-policy-service bot added the Needs: Author Feedback The issue/PR needs activity from its author (label drives bot activity) label May 13, 2024
Co-authored-by: Jon Thysell <thysell@gmail.com>
@microsoft-github-policy-service microsoft-github-policy-service bot removed the Needs: Author Feedback The issue/PR needs activity from its author (label drives bot activity) label May 13, 2024
servusdei2018 and others added 2 commits May 13, 2024 19:03
Signed-off-by: Nathanael Bracy <nate@bracy.dev>
@acoates-ms acoates-ms removed the request for review from jonthysell May 14, 2024 04:38
@acoates-ms acoates-ms merged commit ca565cd into microsoft:main May 14, 2024
53 checks passed
acoates-ms added a commit to acoates-ms/react-native-windows that referenced this pull request May 14, 2024
…icrosoft#13218)

* Change files

* C++20: use view() instead of str() to avoid a copy, use starts_with

Signed-off-by: Nathanael Bracy <nate@bracy.dev>

* fix

* Apply changefile modifications from code review

Co-authored-by: Jon Thysell <thysell@gmail.com>

* Revert package.json

Signed-off-by: Nathanael Bracy <nate@bracy.dev>

---------

Signed-off-by: Nathanael Bracy <nate@bracy.dev>
Co-authored-by: Andrew Coates <30809111+acoates-ms@users.noreply.github.com>
Co-authored-by: Jon Thysell <thysell@gmail.com>
acoates-ms added a commit to acoates-ms/react-native-windows that referenced this pull request May 14, 2024
acoates-ms added a commit that referenced this pull request May 14, 2024
* Cleanup the snapshots in E2E test app (#13229)

* Cleanup the snapshots

* format

* Process snapshots so that ImageSource Uri's are consistent

* Change files

* fix

* fix

* fix(TextInput/isFocused): correctly handle null focused input (#13219)

* Change files

* fix(TextInput/isFocused): correctly handle null focused input

Signed-off-by: Nathanael Bracy <nate@bracy.dev>

* fix

---------

Signed-off-by: Nathanael Bracy <nate@bracy.dev>
Co-authored-by: Andrew Coates <30809111+acoates-ms@users.noreply.github.com>

* Fixing crash when passing null children to view with no-hide-descendents (#13224)

* Preventing crash when passing null children to view with no-hide-descendents

* Change files

---------

Co-authored-by: Sam Walker <sawalker@microsoft.com>
Co-authored-by: Andrew <30809111+acoates-ms@users.noreply.github.com>

* C++20: use view() instead of str() to avoid a copy, use starts_with (#13218)

* Change files

* C++20: use view() instead of str() to avoid a copy, use starts_with

Signed-off-by: Nathanael Bracy <nate@bracy.dev>

* fix

* Apply changefile modifications from code review

Co-authored-by: Jon Thysell <thysell@gmail.com>

* Revert package.json

Signed-off-by: Nathanael Bracy <nate@bracy.dev>

---------

Signed-off-by: Nathanael Bracy <nate@bracy.dev>
Co-authored-by: Andrew Coates <30809111+acoates-ms@users.noreply.github.com>
Co-authored-by: Jon Thysell <thysell@gmail.com>

* ViewComponentView should be activatable from rn-win32.dll (#13225)

* ViewComponentView should be activatable from rn-win32.dll

* Change files

* Cleanup the snapshots in E2E test app (#13229)

* Cleanup the snapshots

* format

* Process snapshots so that ImageSource Uri's are consistent

* Change files

* fix

* fix

* lint

* format

* Revert "C++20: use view() instead of str() to avoid a copy, use starts_with (#13218)"

This reverts commit 71335b5.

---------

Signed-off-by: Nathanael Bracy <nate@bracy.dev>
Co-authored-by: Nate <37554478+servusdei2018@users.noreply.github.com>
Co-authored-by: Sam Walker <samuel.ls.walker@gmail.com>
Co-authored-by: Sam Walker <sawalker@microsoft.com>
Co-authored-by: Jon Thysell <thysell@gmail.com>
Sign up for free to 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.

None yet

4 participants