www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 12435] New: std.range.transposed for immutable matrix too

https://d.puremagic.com/issues/show_bug.cgi?id=12435

           Summary: std.range.transposed for immutable matrix too
           Product: D
           Version: D2
          Platform: x86
        OS/Version: Windows
            Status: NEW
          Keywords: rejects-valid
          Severity: normal
          Priority: P2
         Component: Phobos
        AssignedTo: nobody puremagic.com
        ReportedBy: bearophile_hugs eml.cc


--- Comment #0 from bearophile_hugs eml.cc 2014-03-21 14:30:28 PDT ---
void main() {
    import std.stdio: writeln;
    import std.range: transposed;
    immutable m = [[10, 20], [30, 40]];
    auto t = m.transposed;
    t.writeln;
}


dmd 2.066alpha gives:

...\dmd2\src\phobos\std\range.d(6705,23): Error: template std.array.popFront
cannot deduce function from argument types !()(immutable(int[])), candidates
are:
...\dmd2\src\phobos\std\array.d(569,6):        std.array.popFront(T)(ref T[] a)
if (!isNarrowString!(T[]) && !is(T[] == void[]))
...\dmd2\src\phobos\std\array.d(592,6):        std.array.popFront(C)(ref C[]
str) if (isNarrowString!(C[]))
...\dmd2\src\phobos\std\format.d(2556,17): Error: template instance
std.range.isInputRange!(Transposed!(immutable(int[])[])) error instantiating
...\dmd2\src\phobos\std\format.d(2781,5):        instantiated from here:
enforceValidFormatSpec!(Transposed!(immutable(int[])[]), char)
...\dmd2\src\phobos\std\format.d(3082,16):        instantiated from here:
formatValue!(LockingTextWriter, Transposed!(immutable(int[])[]), char)
...\dmd2\src\phobos\std\format.d(423,54):        instantiated from here:
formatGeneric!(LockingTextWriter, Transposed!(immutable(int[])[]), char)
...\dmd2\src\phobos\std\stdio.d(1158,42):        ... (1 instantiations, -v to
show) ...
...\dmd2\src\phobos\std\stdio.d(2535,21):        instantiated from here:
write!(Transposed!(immutable(int[])[]), char)
test.d(6,6):        instantiated from here:
writeln!(Transposed!(immutable(int[])[]))
...\dmd2\src\phobos\std\format.d(3105,9): Warning: switch case fallthrough -
use 'goto default;' if intended
...\dmd2\src\phobos\std\format.d(3105,9): Warning: switch case fallthrough -
use 'goto default;' if intended


While this simpler program:


void main() {
    import std.range: transposed;
    immutable m = [[10, 20], [30, 40]];
    auto t = m.transposed;
    foreach (row; t) {}
}


Gives:

...\dmd2\src\phobos\std\range.d(6705,23): Error: template std.array.popFront
cannot deduce function from argument types !()(immutable(int[])), candidates
are:
...\dmd2\src\phobos\std\array.d(569,6):        std.array.popFront(T)(ref T[] a)
if (!isNarrowString!(T[]) && !is(T[] == void[]))
...\dmd2\src\phobos\std\array.d(592,6):        std.array.popFront(C)(ref C[]
str) if (isNarrowString!(C[]))

-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Mar 21 2014