diff --git a/source/tanya/format/package.d b/source/tanya/format/package.d index d542529..e283c3d 100644 --- a/source/tanya/format/package.d +++ b/source/tanya/format/package.d @@ -505,10 +505,9 @@ if (T.sizeof == U.sizeof) copy((&src)[0 .. 1], (&dest)[0 .. 1]); } -package(tanya) String format(string fmt, Args...)(auto ref Args args) +private ref String printToString(string fmt, Args...)(return ref String result, + auto ref Args args) { - String result; - static if (is(Unqual!(Args[0]) == typeof(null))) { result.insertBack("null"); @@ -758,6 +757,12 @@ ParamEnd: return result; } +package(tanya) String format(string fmt, Args...)(auto ref Args args) +{ + String formatted; + return printToString!fmt(formatted, args); +} + // One argument tests. @nogc pure @safe unittest {