isExpression with bool template parameter

Ali Çehreli acehreli at yahoo.com
Mon Mar 25 22:28:21 PDT 2013


On 03/25/2013 04:57 PM, cal wrote:
>
> Trying to figure out how to pattern-match struct S below with an
> isExpression:
>
> struct S(A, bool B) {}
>
> static assert ( !is(S!(int, false) _ == S!(U, bool), U) );
> static assert ( !is(S!(int, false) _ == S!(U, V), U, V) );
> static assert ( !is(S!(int, false) _ == S!(U, V), U, V : bool) );
>
> void main(){}
>
> Can someone help?

I am not sure that I understand but usually the test is done in a 
context like foo() below:

struct S(A, bool B) {}

void foo(T)()
{
     static assert(is(T == S!(U, false), U));
}

void main()
{
     foo!(S!(int, false))();
}

Ali


More information about the Digitalmars-d-learn mailing list