Jarrett Billingsley wrote:
On Tue, Jun 2, 2009 at 12:16 AM, Russell Lewis
<[email protected]> wrote:
P.S. Does anybody know why dmd complains "cannot evaluate at compile time"
when I set those regex objects to "static invariant" so I'm not rebuilding
them with every pass?
Because it wants you to have a constant expression to initialize a
static variable, and so it tries to evaluate regex(...) at compile
time. You know, there's a much easier way to prevent them from being
reinitialized every iteration - move their declaration above the loop.
Of course! But then, the code is harder to read. I'll bite the bullet
and move it above the loop, but it's ugly.
And yeah, I know about CTFI and the issues there...I just thought that
regex was designed to allow CTFI. I guess I was wrong?
BTW: I found out how to check if there was a match or not: the empty()
function.