[Issue 533] New: Cannot use int from tuple as an index
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Thu Nov 16 13:38:26 PST 2006
http://d.puremagic.com/issues/show_bug.cgi?id=533
Summary: Cannot use int from tuple as an index
Product: D
Version: 0.174
Platform: All
OS/Version: All
Status: NEW
Severity: normal
Priority: P2
Component: DMD
AssignedTo: bugzilla at digitalmars.com
ReportedBy: wbaxter at gmail.com
An int in a tuple cannot be used as an index for a tuple, even if it is
completely determined at compile time.
---------------------------
// This doesn't work
template Nth(TList...) {
const int N = TList[0];
auto Nth = TList[N];
}
void main()
{
writefln( Nth!(1,"hi","there") );
}
-------------
In this case the sample can be fixed by using:
template Nth(int N, TList...) {
But that's not always the case.
--
More information about the Digitalmars-d-bugs
mailing list