<xstring>: Use memmove in construction of basic_string when the source is a suitable contiguous range#4073
Merged
StephanTLavavej merged 6 commits intomicrosoft:mainfrom Oct 14, 2023
Conversation
<xstring>: Use memcpy in construction of basic_string when the source is a suitable contiguos range<xstring>: Use memcpy in construction of basic_string when the source is a suitable contiguous range
Member
Such |
Member
|
I have updated the PR description's criteria to match the code. |
StephanTLavavej
approved these changes
Oct 6, 2023
This comment was marked as resolved.
This comment was marked as resolved.
CaseyCarter
suggested changes
Oct 6, 2023
Co-authored-by: Casey Carter <cartec69@gmail.com>
Co-authored-by: Casey Carter <cartec69@gmail.com>
<xstring>: Use memcpy in construction of basic_string when the source is a suitable contiguous range<xstring>: Use memmove in construction of basic_string when the source is a suitable contiguous range
StephanTLavavej
approved these changes
Oct 9, 2023
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
55c7167 to
da953f8
Compare
Contributor
Author
|
Oh, I'm sorry for force-pushing because I misconfigured the git settings. |
StephanTLavavej
approved these changes
Oct 10, 2023
CaseyCarter
approved these changes
Oct 13, 2023
Member
|
I'm mirroring this to the MSVC-internal repo - please notify me if any further changes are pushed. |
Member
|
Thanks for improving the performance of one of the STL's most important types! 🚀 😸 🎉 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #2901.
Criteria:
EcharT(encoded character type, i.e.char,wchar_t,char8_t,char16_t,char32_t)Perhaps we can extend the criteria to
move_iteratorand unscoped enumeration types later.Clang's
__builtin_memcpydoesn't work when copying achararray to achar8_tarray in constant evaluation (nor does GCC's), so this PR isn't using it in the involved construction.The test
P1206R7_string_from_rangeis largely extended to cover some related contiguous ranges and character types. The originaltest_c_arrayseemed to be a duplicate oftest_copyable_views, so I changed it to properly cover built-in arrays.