You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The range should match ß, since ß collates like ss and should be sorted between s and t (and thus between a and z as well). Hence, the output of this program should be:
1
1 1
Actual behavior
The range does not match ß, so the actual output is:
0
1 1
Note that the output of the second line shows that the problem does not lie in the implementation of regex_traits<wchar_t>::transform, as it returns sort keys that are equal for ß and ss and place ß between s and t.
The text was updated successfully, but these errors were encountered:
This replaces the character by the collation order sort key when the sort key has length 1 and otherwise returns the character itself.
But calling regex_traits<_Elem>::transform() on a sort key does not return the same sort key again, so I was worried that range matching would get broken even more in collate mode if the result of regex_traits<_Elem>::translate() were to be passed to regex_traits<_Elem>::transform() as the standard mandates. (This would even be a problem if we fixed translate() because there is no guarantee the fixed version would be picked up in a mix-and-match situation.)
But after some experimentation, it appears that LCMapStringA/W() always return sort keys with length greater 1. Hence, _Strxfrm()/_Wcsxfrm(), collate<_Elem>::transform() and regex_traits<_Elem>::transform() also return sort keys with length greater 1, except when the C locale is used, as then the input string (composed of argument _Ch only) is just returned as the sort key by_Strxfrm()/_Wcsxfrm().
So it seems that this function effectively just does return _Ch in a very complicated and expensive way.
When the
regex_constants::collate
flag is set, character ranges fail to match characters according to the locale's collation order.Test case
Godbolt link
Expected behavior
The range should match
ß
, sinceß
collates likess
and should be sorted betweens
andt
(and thus betweena
andz
as well). Hence, the output of this program should be:Actual behavior
The range does not match
ß
, so the actual output is:Note that the output of the second line shows that the problem does not lie in the implementation of
regex_traits<wchar_t>::transform
, as it returns sort keys that are equal forß
andss
and placeß
betweens
andt
.The text was updated successfully, but these errors were encountered: