On Sunday, 28 September 2014 at 19:19:56 UTC, Foo wrote:
mixin template New(T) if (is(T == class)) {
        static T New(Args...)(Args args) {
            return new T(args);
        }
}

fwiw here's what i wrote:

template New(T) if (is(T == class)) {
    T New(Args...) (Args args) {
        return new T(args);
    }
}

...

New!Bar("hi").txt.writeln;

not as neat as your version but still improves on the ugly (new Class()).method syntax and doesn't need to be mixed into the class definition.

Reply via email to