[Issue 533] Cannot use int from tuple as an index

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sat Jun 28 00:48:44 PDT 2008


http://d.puremagic.com/issues/show_bug.cgi?id=533





------- Comment #4 from wbaxter at gmail.com  2008-06-28 02:48 -------
(In reply to comment #3)
> The example is broken because in order for the 'promotion' of the member Nth,
> it must be the only member. The following works:
> 
> import std.stdio;
> 
> template Nth(TList...) {
>     const int N = TList[0];
>     auto Nth = TList[N];
> }
> void main()
> {
>     writefln( Nth!(1,"hi","there").Nth );
> }
> 

Good point.  Or use the version I posted above without the intermediate
variable.  I blame the misunderstanding on my youth at the time of reporting
this one.  :-)  


-- 



More information about the Digitalmars-d-bugs mailing list