On Sun, 20 Jun 2010 06:18:46 +0900, Philippe Sigaud <[email protected]> wrote:

Andrei:
this(U)(U another) if (is(U == Tuple!(V), V...)) { ... }

Sean:

Is that 'is' syntax correct?


No, halas you can't put a V... inside an is expression. Only is(U ==
Tuple!V, V) is authorized.
To detect a Tuple, I use the following workaround: std.typecons.Tuple has a
.Types member, so test for it (and btw .Types will give you the V tuple):

this(U)(U another) if (is(U.Types)) // U is a Tuple

{
alias U.Types V;
...
}

also, testing for U.stringof beginning with "Tuple!("... But I don't like
this.


I use following isTuple.

template isTuple(T)
{
enum isTuple = __traits(compiles, { void f(X...)(Tuple!X t) {}; f(T.init); });
}


Masahiro
_______________________________________________
phobos mailing list
[email protected]
http://lists.puremagic.com/mailman/listinfo/phobos

Reply via email to