On 2/5/13, Andrei Alexandrescu <seewebsiteforem...@erdani.org> wrote:
> Care for a shotgun search/replace pull request?

Looking at the implementation:

string text(T...)(T args)
{
    return textImpl!string(args);
}

private S textImpl(S, U...)(U args)
{
    S result;
    foreach (i, arg; args)
    {
        result ~= to!S(args[i]);
    }
    return result;
}

I can see 2 optimizations here:

1. Use a static if to replace the append operator with a simple return
when there's only one argument
2. Use Appender instead of a regular string for multiple arguments.

Unfortunately #2 won't fly because std.regex uses text and it expects
it to be safe, but Appender isn't safe.

Reply via email to