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

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Feb 26 13:25:37 PST 2014


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


bearophile_hugs at eml.cc changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bearophile_hugs at eml.cc


--- Comment #6 from bearophile_hugs at eml.cc 2014-02-26 13:25:31 PST ---
(In reply to comment #5)
> Commits pushed to master at https://github.com/D-Programming-Language/phobos
> 
> https://github.com/D-Programming-Language/phobos/commit/301b42f0de6444db0e03067bbe4f899a41ba4fb2
> Fix issue 12007 - cartesianProduct does'nt work with ranges of immutables

After re-compiling Phobos, if I try to compile this:

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


I see the errors:

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

Perhaps I am doing something wrong, or I have a wrong Phobos?

-- 
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