How to avoid ctRegex (solved)

ag0aep6g via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Tue Aug 23 22:29:57 PDT 2016


On 08/24/2016 03:07 AM, cy wrote:
> Then what's ctRegex in there for at all...?

Optimization.

ctRegex requires that the pattern is available as a compile time 
constant. It uses that property to "generate optimized native machine code".

The plain regex function doesn't have such a requirement. It also works 
with a pattern that's generated at run time, e.g. from user input. But 
you can use it with a compile time constant, too. And it works in CTFE 
then, but it does not "generate optimized native machine code".


More information about the Digitalmars-d-learn mailing list