How to avoid ctRegex (solved)

ag0aep6g via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Mon Aug 22 21:51:19 PDT 2016


On 08/23/2016 06:06 AM, cy wrote:
> On Sunday, 21 August 2016 at 21:18:11 UTC, ag0aep6g wrote:
>
>> I may be missing the point here, but just putting `auto pattern =
>> regex("foobar");` at module level works for me.
>
> Really? I thought global variables could only be initialized with static
> stuff available during compile time, and you needed a "static this() {}"
> block to initialize them otherwise.

That's true, and apparently `regex("foobar")` can be evaluated at 
compile time.


More information about the Digitalmars-d-learn mailing list