how to iterate on Array?
aki via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Sat Jun 27 10:43:12 PDT 2015
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.
More information about the Digitalmars-d-learn
mailing list