--- Comment #1 from Andrej Mitrovic <> 2011-08-29 
20:16:51 PDT ---
However the code will have to be slightly improved.

If you accidentally pass a tuple followed by a single type things can get


template isOneOf(X, T...)
    static if (!T.length)
        enum bool isOneOf = false;
    else static if (is (X == T[0]))
        enum bool isOneOf = true;
        enum bool isOneOf = isOneOf!(X, T[1..$]);

void test(T...)(T t)
    static assert (isOneOf!(T, double));  // passes by mistake
    static assert (isOneOf!(double, T));  // ok, fails properly


void main()
    test(1, 2, 3);

So that's something to improve.

Configure issuemail:
------- You are receiving this mail because: -------

Reply via email to