C++ Logo

std-discussion

Advanced search

Re: Problem of the type requirement of the regex library

From: Xie He <hexie3605_at_[hidden]>
Date: Sat, 28 Dec 2019 19:34:08 -0800
On Dec 28, 2019 at 1:29 PM Tom Honermann wrote:
>
> On 12/24/19 2:47 AM, Xie He via Std-Discussion wrote:
> > Proposed solution:
> > In 30.1 [re.general] Paragraph 2, change "char-like template
> > arguments" to "template arguments that are integral types that encode
> > Unicode code point values, with char_traits<the type> having its
> > two-parameter assign, eq and lt functions provide identical results as
> > the =, ==, < operators, for all valid code points the type supports".
>
> We can't require Unicode code point values, at least not without it
> being a breaking change.
>
I have another solution. Instead of requiring the type to hold Unicode
code point values, we can change the requirements of the regex traits
class (30.3 [re.req]) so that the "locale_type" (Table 133
[tab:re.req]) is required to be std::locale. This way, the
implementation is able to convert regex syntactical characters, such
as '*', '+', '\n', "\u2028", "\u2029" to the character type MyChar
through "use_facet<ctype<MyChar>>(getloc()).widen" or
"use_facet<codecvt<MyChar, char, mbstate_t>>(getloc())", assuming that
these facets exist (either provided by default or provided by the
user).

Received on 2019-12-28 21:36:47