-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
<xstring>
: constexpr string element lifetime
#3334
Conversation
I've never trusted our use of `_Traits::assign` to start the lifetimes of the elements given that, err, that's not what `_Traits::assign` does. Let's use a `construct_at` loop instead, and centralize it into a helper function instead of repeating nine times. Test coverage will be in a future LLVM update. Drive-by: Use `_Traits::copy` instead of `_Traits::move` in `_Construct`. Since we're constructing a new string, we now the argument doesn't alias our content.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good! We may want to make _Activate_SSO_buffer
call _Start_element_lifetimes
as well.
I'm happy for SSO activation to continue to use union member assignment to start the element lifetimes. This does at least suggest that EDIT: |
Address STL's review comment, and clarify the difference between _Activate_SSO_buffer and _Start_element_lifetimes.
I'm mirroring this to the MSVC-internal repo - please notify me if any further changes are pushed. |
Thanks for finding out how to fix these libcxx skips, and centralizing all of the duplicated code here! 😻 🚀 😻 |
I've never trusted our use of
_Traits::assign
to start the lifetimes of the elements given that, err, that's not what_Traits::assign
does. Let's use aconstruct_at
loop instead, and centralize it into a helper function instead of repeating nine times.Test coverage is in libcxx - 7 skips fixed!
Drive-by: Use
_Traits::copy
instead of_Traits::move
in_Construct
. Since we're constructing a new string, we know the argument doesn't alias our content.