Hello,
when trying to process an string at compile time with
 ...
 auto reg = ctRegex!`as\ [a-z]+`;
 enum replaced = replaceAll(call,reg,"");

I get:
/usr/include/dmd/phobos/std/regex/package.d(708,34): Error: malloc cannot be interpreted at compile time, because it has no available source code /usr/include/dmd/phobos/std/regex/package.d(708,27): called from here: enforce(malloc(size), delegate const(char)[]() => "malloc failed", "/usr/include/dmd/phobos/std/regex/package.d", 708LU) /usr/include/dmd/phobos/std/regex/package.d(832,34): called from here: ((RegexMatch!(string, BacktrackingMatcher) __slRegex3165 = RegexMatch(BacktrackingMatcher(Regex(null, null, null, 0u, 0u, 0u, 0u, 0u, null, null, null, ShiftOr(null, 0u, 0u)), null, Input(null, 0LU), 0LU, '\U0000ffff', false, 0u, 0u, 0LU, null, null, null, null), null, Captures(null, 0, null, , 0u, 0u, 0u, null), null);) , __slRegex3165).this(input, re) /usr/include/dmd/phobos/std/regex/package.d(1049,48): called from here: matchMany(input, re) /usr/include/dmd/phobos/std/regex/package.d(906,26): called from here: matchAll(input, re) /usr/include/dmd/phobos/std/regex/package.d(1345,69): called from here: replaceAllWith(input, re) src/app.d(13,29): called from here: replaceAll(call, reg, "")

It there a way to use "replaceAll" at compile time?

Regards mt.
  • CTFE using of replaceAll from ... Martin Tschierschke via Digitalmars-d-learn

Reply via email to