Hello!

Consider this code:

+++
import std.stdio;
import std.range;
import std.algorithm;

void printIndexedArray1(T, Range)(T[] source, Range indexes)
{
        foreach(row; zip(indexes, source))
        {
                foreach(col; row) {
                        write(col, " ");
                }
                writeln;
        }
}

void printIndexedArray2(T, Range)(T[] source, Range indexes)
{
        writef("%(%(%s %)\n%)", zip(indexes, source));
}

void main()
{
        uint[] data = [17, 30, 48, 140, 10, 01, 126, 138, 140, 3, 501];
        printIndexedArray1(data, sequence!"n");
        printIndexedArray2(data, sequence!"n");

}
+++

Looks fairly straightforward. But, the second function causes compilation error:

std.format.FormatException@C:\D\dmd2\windows\bin\..\..\src\phobos\std\format.d(2
585): Expected '%s' format specifier for type 'Tuple!(uint, uint)'

Can you help me with that?

Reply via email to