May 30, 2012
Greetings

What would be the form of "is" expression to match with a Variadic Template
Class?
I am pasting a simple example below to clarify my need. I need an is
expression to match with the Bar(T...) type in the code below.

Regards
- Puneet

class Foo(int N=0) {}

class Bar(T...) {}

void foobar(L) (ref L l)
  if(is(L f : Foo!N, int N))
    {
      import std.stdio;
      writeln("Matched a Foo(int N)");
    }

void foobar(L) (ref L l)
  if // WHAT IS EXPRESSION SHOULD COME HERE
    {
      import std.stdio;
      writeln("Matched a Bar(T...)");
    }

void main() {
  Foo!0 foo = new Foo!0();
  Bar!() bar = new Bar!();
  foobar(foo);
  foobar(bar);
}


May 30, 2012
On Wed, 30 May 2012 14:38:50 +0200, d coder <dlang.coder@gmail.com> wrote:

> Greetings
>
> What would be the form of "is" expression to match with a Variadic Template
> Class?
> I am pasting a simple example below to clarify my need. I need an is
> expression to match with the Bar(T...) type in the code below.
>
> Regards
> - Puneet
>
> class Foo(int N=0) {}
>
> class Bar(T...) {}
>
> void foobar(L) (ref L l)
>   if(is(L f : Foo!N, int N))
>     {
>       import std.stdio;
>       writeln("Matched a Foo(int N)");
>     }
>
> void foobar(L) (ref L l)
>   if // WHAT IS EXPRESSION SHOULD COME HERE

is(L unused : Bar!T, T...)



>     {
>       import std.stdio;
>       writeln("Matched a Bar(T...)");
>     }
>
> void main() {
>   Foo!0 foo = new Foo!0();
>   Bar!() bar = new Bar!();
>   foobar(foo);
>   foobar(bar);
> }