On Tuesday, 6 March 2018 at 20:37:34 UTC, Steven Schveighoffer wrote:
What triggers the compile-time execution is the fact that static *initializers* need to be decided at compile time.

So while it is executing the regex building at compile time in your example, there are other ways to do it, and in this case, I'd prefer using an enum. You can also use ctRegex.

The drawback of using static is that it keeps its value between function calls:

What about static immutable? I think enums exist only for compiler but they're not a l-value, so you can't take a reference, am I wrong?


Reply via email to