new DIP40: Template parameter deduction for constructors

Kenji Hara k.hara.pg at gmail.com
Mon May 13 20:20:49 PDT 2013


Currently conditional compilation would stop IFTI.

template foo(T)
{
    static if (is(T == int))
        void foo(T) {}
}
void main()
{
    foo(1);   // shouldn't work
}

Same as above, DIP40 should prevent following case.

template foo(T)
{
    struct foo
    {
        static if (is(T == int))
            this(T) {}
    }
}
void main()
{
    foo(1); // also should not work
}

Kenji Hara

2013/5/14 Timothee Cour <thelastmammoth at gmail.com>

> Thanks for the feedback, I've clarified the deduction mechanism and
> show how it falls back to normal function template deduction.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/digitalmars-d/attachments/20130514/280924f8/attachment.html>


More information about the Digitalmars-d mailing list