isExpression with bool template parameter

cal callumenator at gmail.com
Mon Mar 25 23:03:51 PDT 2013


On Tuesday, 26 March 2013 at 05:28:22 UTC, Ali Çehreli wrote:
> 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

Maybe I gave a bad example, I guess I wonder why line A passes 
but line B fails:

struct S(A, bool B) {}

static assert(is(S!(int, false) _ == S!(U, false), U)); // line 
A, pass
static assert(is(S!(int, false) _ == S!(U, V), U, V));  // line 
B, fail

void main(){}

I.e., why I can't match on some generic second parameter - what 
if the second parameter was an int:

struct S(A, int B) {}
static assert(is(S!(int, 5627) _ == S!(U, ??), U, ??));

how to match that in the isExpression?

cheers,
cal



More information about the Digitalmars-d-learn mailing list