C++20 constexpr _Copy_s and simplify char8_t compare #861
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_s
andbasic_string_view::_Copy_s
as_CONSTEXPR20
. Similarly to how Misc constexpr #491 changedcopy
, previously_Copy_s
was alwaysconstexpr
inbasic_string_view
but 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 theseconstexpr
in C++20 mode only is simpler to explain.Simplify
char_traits::compare
forchar8_t
. This is possible becausememcmp
and__builtin_memcmp
takeconst void*
and returnint
, and their behavior is correct forchar8_t
. The otheru8
intrinsics are type-sensitive so they can't be unified like this.