On Sun, 26 Oct 2014 12:46:06 +0000 via Digitalmars-d-learn <digitalmars-d-learn@puremagic.com> wrote:
> Ok, I see two possibilities. The first is to make `prstr` into a > normal function. You cannot use `stringof` then, but need to > escape the string yourself. Luckily, std.format provides > functionality for this already, albeit a bit hidden: > > private auto escapeStringLiteral(string s) { > import std.format : formatElement, FormatSpec; > import std.range : appender; > > auto app = appender!string; > FormatSpec!char f; > formatElement(app, s, f); > > return app.data; > } thank you, this is very handy. yet my desire to instantiate template with compile-time variable still remains. ;-)
signature.asc
Description: PGP signature