-
Notifications
You must be signed in to change notification settings - Fork 1.6k
<regex>: Compare against char directly
#5675
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
<regex>: Compare against char directly
#5675
Conversation
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.
LGTM, just some questions
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.
Looks good to me as well.
I also briefly checked the remaining static_cast's to _Elem in <regex>, but these are either meaningful round-trip casts or they appear in instances where we can't avoid casting to _Elem at some point (at least as long as we don't want to support heterogeneous char_traits or regex_traits implementations, which even Build2 does not provide.)
|
@davidmrdavid @muellerj2 I've pushed changes to the test, improving the casts and centralizing the operators. Thanks for the reviews! 😻 |
|
I'm mirroring this to the MSVC-internal repo - please notify me if any further changes are pushed. |
|
I've pushed a non-trivial merge with This fixes the conflict in |
Fixes #5673 and fixes VSO-2548012 in conjunction with small Build2 changes.
Build2 is doing something extremely complicated and fragile with user-defined character types and
regex. When we construct user-defined_Elemfrom ordinarychars, that triggers assertions in their machinery, even though the resulting homogeneous comparisons between_Elemand_Elemare arguably more cromulent.This PR slightly backs off from the purity of such comparisons, resulting in code that's somewhat closer to our old way of doing things, but still avoiding the internal
_Uelemmachinery. Now we directly compare_Elemtochar. Build2 has heterogeneous comparison operators that handle this.It will still be necessary to update Build2 to round-trip their user-defined character type instead of asserting, but that's a less invasive change: build2/build2#478
This makes no difference to the vast, vast majority of users who simply use
charorwchar_t.