digitalmars.D.learn - CTFE using of replaceAll from std.regex posible?
- Martin Tschierschke (30/30) Apr 12 2017 Hello,
- Stefan Koch (5/7) Apr 12 2017 Not yet :)
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.
Apr 12 2017
On Wednesday, 12 April 2017 at 12:00:27 UTC, Martin Tschierschke wrote:It there a way to use "replaceAll" at compile time? Regards mt.Not yet :) I assume it would bring the current system to it's needs. I you want to experiment you could replace malloc with new.
Apr 12 2017