Converting a number to complex
Artur Skawina
art.08.09 at gmail.com
Sat Nov 24 10:16:55 PST 2012
On 11/24/12 12:30, Philippe Sigaud wrote:
>
> Unfortunately the is-expressions don't handle aliases properly, at least
> with my old compiler here. So this does not work:
>
> template isTempInst(alias TEMPL, T) {
> static if (is(T _ == TEMPL!CT, CT))
> enum isTempInst = true;
> else
> enum isTempInst = false;
> }
>
>
> Works for me:
>
>
> template isTempInst(alias TEMPL, T)
> {
> static if (is(T _ == TEMPL!CT, CT...))
> enum isTempInst = true;
> else
> enum isTempInst = false;
> }
>
> void main()
> {
>
> Tuple!(int,string) t = tuple(1, "abc");
> writeln(typeof(t).stringof);
> writeln(isTempInst!(Tuple, typeof(t)));
> }
>
> (DMD 2.060)
Then it's probably just my old compiler, gdc r748:ab99d67f04c2, using dmd 2.057,
which thinks that that is-expression is always false.
artur
More information about the Digitalmars-d-learn
mailing list