Xpressive provides a "tips n tricks" to:
Compiling a regex (dynamic or static) is more expensive than executing
a match or search. If you have the option, prefer to compile a pattern
into a basic_regex<> object once and reuse it rather than recreating
it over and over.
Would it be feasible/advantageous for the regex-related libraries to
automagically to "cache" the immediately previous regex compilation?
(or provide as an option)
I've seen code that had the same regex being compiled inside a loop,
which I suppose would really diminish performance. Perhaps this could
be detected, and the user/developer "protected from themselves" ...
and/or perhaps informed that this is happening?
Could there be a "helper" class that somehow or other allowed the last
"n" regexes to be cached? (btw .... what is the plural of regex ....
regexen? regices?)
</alert>