On Saturday, 27 June 2015 at 17:43:13 UTC, aki wrote:
I want to print the contents of Array!int

import std.stdio;
import std.container;

void pr(Array!int a) {
        foreach(i, v; a[]) {
                writeln("%4s: %s\n", i, v);
        }
}

But when I compile it by DMD 2.062 on Windows
it says:

testArray.d(5): Error: cannot infer argument types
(line 5 is at "foreach(i, v; a[]) {" )

What's wrong? how can I iterate the array?

Thanks, aki.

size_t i;
foreach (v; a[])
  writeln("%s: %s", i++, v);

Reply via email to