[Issue 12007] cartesianProduct does'nt work with ranges of immutables

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Feb 26 14:55:50 PST 2014


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



--- Comment #9 from bearophile_hugs at eml.cc 2014-02-26 14:55:35 PST ---
(In reply to comment #8)

> It should be working fine now (your code works fine for me). You can try it
> again now.

Unfortunately I am still seeing problems:

void main() {
    import std.algorithm: cartesianProduct;
    auto s = "123456789"d;
    foreach (p; cartesianProduct(s, s, s)) {}
}


It gives me:

...\dmd2\src\phobos\std\algorithm.d-mixin-3643(3655,17): Error: cannot modify
struct this._current Zip!(immutable(dchar)[], Repeat!(Tuple!(immutable(dchar),
immutable(dchar)))) with immutable members
...\dmd2\src\phobos\std\algorithm.d(3652,17): Error: cannot modify struct
copy._current Zip!(immutable(dchar)[], Repeat!(Tuple!(immutable(dchar),
immutable(dchar)))) with immutable members
...\dmd2\src\phobos\std\algorithm.d(12624,22): Error: template instance
std.algorithm.joiner!(MapResult!(__lambda3, Result)) error instantiating
...\dmd2\src\phobos\std\algorithm.d(12843,25):        instantiated from here:
cartesianProduct!(immutable(dchar)[], Result)
test.d(4,33):        instantiated from here:
cartesianProduct!(immutable(dchar)[], immutable(dchar)[], immutable(dchar)[])
...\dmd2\src\phobos\std\algorithm.d(12843,25): Error: template instance
std.algorithm.cartesianProduct!(immutable(dchar)[], Result) error instantiating
test.d(4,33):        instantiated from here:
cartesianProduct!(immutable(dchar)[], immutable(dchar)[], immutable(dchar)[])
test.d(4,33): Error: template instance
std.algorithm.cartesianProduct!(immutable(dchar)[], immutable(dchar)[],
immutable(dchar)[]) error instantiating


(By the way, in my opinion the most important fix for cartesianProduct is to
correct the order of its output. This is in another bug report.)

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


More information about the Digitalmars-d-bugs mailing list