On 11/06/2012 04:25 PM, Joseph Rushton Wakeling wrote:
Look at the is() expression in the language spec.

I didn't get it to work with a template constraint, because the pattern matched parameter are out of scope in the function body.

----
struct A(T1, T2)
{
}

struct B(B1, B2) {}


void foo(T)(T x)
{
    static if(is(T Dummy : A!(P), P...))
    {
        pragma(msg, P);
    }
}

void main() {
    A!(int, float) a;
    foo(a);
}

Reply via email to