How to avoid ctRegex (solved)

David Nadlinger via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sat Aug 27 10:56:07 PDT 2016


On Saturday, 27 August 2016 at 17:47:33 UTC, Dicebot wrote:
> But actual value of that Regex struct is perfectly known during 
> compile time. Thus it is possible and fine to use it as 
> initializer. You can use any struct or class as initializer if 
> it can be computed during compile-time.

Yes, regex() is CTFEable, but this still comes at a significant 
compile-time cost as the constructor does quite a bit of string 
manipulation, etc. I've seen this, i.e. inconsiderate use of 
regex() globals, cost tens of seconds in build time for bigger 
codebases.

  — David


More information about the Digitalmars-d-learn mailing list