C++20 constexpr _Copy_s and simplify char8_t compare#861
Merged
Conversation
CaseyCarter
approved these changes
May 24, 2020
mnatsuhara
approved these changes
May 26, 2020
Member
Author
|
Thanks, @CaseyCarter, for these improvement ideas! |
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.
Followup to #491, in response to #491 (comment) and #491 (comment).
Mark our non-Standard extension
char_traits::_Copy_sandbasic_string_view::_Copy_sas_CONSTEXPR20. Similarly to how Misc constexpr #491 changedcopy, previously_Copy_swas alwaysconstexprinbasic_string_viewbut never inchar_traits; I similarly argue that this will not affect users because it would have required them to notice and provide a custom traits class (and in this case, the non-Standard extension is far more obscure than the Standard function). Making theseconstexprin C++20 mode only is simpler to explain.Simplify
char_traits::compareforchar8_t. This is possible becausememcmpand__builtin_memcmptakeconst void*and returnint, and their behavior is correct forchar8_t. The otheru8intrinsics are type-sensitive so they can't be unified like this.