Boost logo

Boost :

From: Eric Niebler (eric_at_[hidden])
Date: 2007-03-19 15:58:17

John Maddock wrote:
> Eric Niebler wrote:
>> the RegexTraits concept doesn't have
>> toupper() and tolower() functions. I suggest adding them.
> Right, but format_perl isn't part of TR1, so this is all in the realms of
> vendor-specific extensions. I added some *optional* extra members to the
> traits class to deal with this: the code detects at compile time whether the
> member are there, and uses them if they are, otherwise uses some sensible
> defaults.

Ah. I didn't know that format_perl didn't make the cut. But it's still a
problem for RegexTraits::value(), format_default ("$1") and format_sed

To be honest, I find the need for the hacks you describe above to be a
bit distasteful. Any vendor who wants format_perl-like behavior will
route around the damage in the RegexTraits concept. A better (?) design
might have to been to go whole-hog with locales and facets, and define
some standard regex traits facets that basic_regex<> and match_results<>
can query for at runtime. Eg.: If a regex-trait version-2 facet isn't
installed, try for version-1, then defer to the ctype and collate
facets, etc. And the traits doesn't need to be part of the basic_regex<>
type (it isn't in xpressive). C-compatibility could have been maintained
by providing a ctype facet that is implemented in terms of the global C
locale. The whole RegexTraits concept and version tags seem like wheel
reinvention to me.

Just thinking out loud,

Eric Niebler
Boost Consulting

Boost list run by bdawes at, gregod at, cpdaniel at, john at