foreach and retro
Timon Gehr
timon.gehr at gmx.ch
Mon Jul 2 08:48:39 PDT 2012
On 07/02/2012 05:36 PM, Joseph Rushton Wakeling wrote:
> 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
What would be your expected output?
More information about the Digitalmars-d
mailing list