Proposal: static template(fail)

Janice Caron caron800 at googlemail.com
Thu Dec 13 06:31:15 PST 2007


I would like to propose a new statement:

    static template(fail);

which causes a compile-time substitution failure. And remember: SFINAE
- Substitution Failure Is Not An Error

Let me give you an example:

    struct S(T)
    {
        static if(isFloatingPoint!(T))
        {
            /*...*/
        }
        else static if(passesSomeVeryComplicatedTest!(T))
        {
            /*...*/
        }
        else
        {
            static template(fail); // SFINAE
        }
    }

This has advantages over old-style specialisation.



More information about the Digitalmars-d mailing list