[Issue 13092] New: std.algorithm.cartesianProduct of Nullable Tuple of strings array too

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Fri Jul 11 01:00:33 PDT 2014


https://issues.dlang.org/show_bug.cgi?id=13092

          Issue ID: 13092
           Summary: std.algorithm.cartesianProduct of Nullable Tuple of
                    strings array too
           Product: D
           Version: D2
          Hardware: x86
                OS: Windows
            Status: NEW
          Keywords: rejects-valid
          Severity: normal
          Priority: P1
         Component: Phobos
          Assignee: nobody at puremagic.com
          Reporter: bearophile_hugs at eml.cc

I think all this program should compile:


void main() {
    import std.typecons: Tuple, Nullable;
    import std.algorithm: cartesianProduct;
    string[] a;
    const Nullable!(Tuple!(string[])) b;
    const string[] c = b.get[0]; // OK
    foreach (ab; cartesianProduct(a, c)) {} // OK
    foreach (ab; cartesianProduct(a, b[0])) {} // fails
    foreach (ab; cartesianProduct(a, b.get[0])) {} // fails
}


With dmd 2.066beta2 it gives:

...\dmd2\src\phobos\std\algorithm.d(12783,10): Error: static assert 
"cartesianProduct involving finite ranges must have at least one finite forward
range"
test.d(8,34):        instantiated from here: cartesianProduct!(string[],
const(immutable(char)[][]))

--


More information about the Digitalmars-d-bugs mailing list