www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 13092] New: std.algorithm.cartesianProduct of Nullable Tuple


          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 puremagic.com
          Reporter: bearophile_hugs 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
test.d(8,34):        instantiated from here: cartesianProduct!(string[],

Jul 11 2014