
Eric Niebler wrote:
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,
Think all you like: it's fair comment. Actually the original regex implementation used a custom facet installed in the locale rather than a traits class: but broken and poorly behaved locale implementations caused me so much hassle that in the end I gave up and used a traits class instead :-( Use of a traits class also makes it easier IMO to use non-std locale mechanisms (the Win32 API's or ICU's locale support) if you want to. Still learning yours.... John.