Proposal: static template(fail)

Janice Caron caron800 at googlemail.com
Thu Dec 13 12:41:55 PST 2007


On 12/13/07, Bill Baxter <dnewsgroup at billbaxter.com> wrote:
> No, you have to make one of them specialized somehow, otherwise it's
> just a good old fashioned redundant definition error.  Like if you tried
> to make two functions "void foo(int)".

I agree. But in the particular example you cited, you could instead just write

    struct S(T)
    {
        static if(is(T==int)) static template(fail);
    }

because the "else" condition is empty. Then S!(int) would fail, but
S!(float) would succeed.



More information about the Digitalmars-d mailing list