www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 10613] New: cartesianProduct of const arrays


           Summary: cartesianProduct of const arrays
           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 2013-07-11 10:50:17 PDT ---
import std.algorithm: cartesianProduct;
void main() {
    auto a = [1, 2];
    cartesianProduct(a, a); // OK
    const b = [1, 2];
    cartesianProduct(b, b); // Error

dmd 2.064alpha gives:

...\dmd2\src\phobos\std\range.d(4158): Error: cannot modify struct
result._ranges_field_1 Repeat!const(int) with immutable members
...\dmd2\src\phobos\std\range.d(4454): Error: template instance
std.range.Zip!(const(int)[], Repeat!const(int)) error instantiating
...\dmd2\src\phobos\std\algorithm.d(11423):        instantiated from here:
zip!(const(int)[], Repeat!const(int))
test.d(6):        instantiated from here: cartesianProduct!(const(int)[],
...\dmd2\src\phobos\std\algorithm.d(11423): Error: template instance
std.range.zip!(const(int)[], Repeat!const(int)) error instantiating
test.d(6):        instantiated from here: cartesianProduct!(const(int)[],
test.d(6): Error: template instance
std.algorithm.cartesianProduct!(const(int)[], const(int)[]) error instantiating

Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jul 11 2013