Need is expression to match Variadic Template Class Type

d coder dlang.coder at gmail.com
Wed May 30 05:38:50 PDT 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);
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/digitalmars-d/attachments/20120530/faa3e7fa/attachment.html>


More information about the Digitalmars-d mailing list