foreach and retro
Joseph Rushton Wakeling
joseph.wakeling at webdrake.net
Mon Jul 2 08:36:28 PDT 2012
Hello all,
A problem with the retro function from std.range -- although it apparently
operates on a bidirectional range, it fails when used with foreach requesting
both value and index. Running this code:
////////////////////////////////////////////////
import std.range, std.stdio;
void main()
{
double[] a = [ 0, 1, 2, 3, 4, 5 ];
foreach(i, x; retro(a))
writeln(i, "\t", x);
}
////////////////////////////////////////////////
... results in an error: "cannot infer argument types".
Is there any reason why this should be so, or is it (as it seems to me) just a bug?
Thanks & best wishes,
-- Joe
More information about the Digitalmars-d
mailing list