Class template argument deduction from constructor call

sergk kovrov+puremagic at gmail.com
Wed Oct 27 12:36:32 PDT 2010


class Foo(T) {
    this(T t) {
        bar = t;
    }
    T bar;
}

void main() {
    auto a = new Foo(123); // doesn't work
    auto b = new Foo!(int)(123); // work, but redundant
}

Is there any technical limitations preventing this, or its just a compiler bug?


-- 
serg.


More information about the Digitalmars-d-learn mailing list