← Back to index
|
Original Bugzilla link
Bug 10613 – cartesianProduct of const arrays
Status
RESOLVED
Resolution
DUPLICATE
Severity
normal
Priority
P2
Component
phobos
Product
D
Version
D2
Platform
x86
OS
Windows
Creation time
2013-07-11T10:50:00Z
Last change time
2014-06-20T21:15:52Z
Keywords
rejects-valid
Assigned to
nobody
Creator
bearophile_hugs
Comments
Comment #0
by bearophile_hugs — 2013-07-11T10:50:17Z
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)[], 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)[], const(int)[]) test.d(6): Error: template instance std.algorithm.cartesianProduct!(const(int)[], const(int)[]) error instantiating
Comment #1
by bearophile_hugs — 2014-06-20T21:15:52Z
*** This issue has been marked as a duplicate of issue 12007 ***