No constructor for a templated class?

Philippe Sigaud philippe.sigaud at gmail.com
Sun Jul 25 05:55:48 PDT 2010


OK, I must be tired, I don't know.
While switching from a template struct to a templated class, I got the
following problem:

class A(T)
{
    T _t;
    this(U)(U u) if (is(U == T))
    {
        _t = u;
    }
}

void main()
{
    auto aa = new A!(double)(1.0); // line 12
}

Error (12): no constructor for A.

What am I doing wrong?


Philippe




More information about the Digitalmars-d-learn mailing list