Tuples not working?

Jonathan Marler via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Fri Jan 9 10:42:18 PST 2015


import std.stdio;
import std.typecons;
void main()
{
   alias TL = Tuple!(int, long, float);
   foreach (i, T; TL)
     writefln("TL[%d] = %s", i, typeid(T));
}

Why is this not working?

D:\dmd2\windows\bin\..\..\src\phobos\std\typecons.d(419): Error: 
need 'this' for '_expand_field_0' of type 'int'
D:\dmd2\windows\bin\..\..\src\phobos\std\typecons.d(419): Error: 
need 'this' for '_expand_field_1' of type 'long'
D:\dmd2\windows\bin\..\..\src\phobos\std\typecons.d(419): Error: 
need 'this' for '_expand_field_2' of type 'float'

Tried to compile using dmd 2.066 and dmd 2.067.  Code taken 
directly from dlang website here (http://dlang.org/tuple.html). 
Thanks.


More information about the Digitalmars-d-learn mailing list