[Issue 9734] New: setIntersection accepts only 2 ranges, but documentation says otherwise

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sat Mar 16 03:18:27 PDT 2013


http://d.puremagic.com/issues/show_bug.cgi?id=9734

           Summary: setIntersection accepts only 2 ranges, but
                    documentation says otherwise
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: websites
        AssignedTo: nobody at puremagic.com
        ReportedBy: josvanuden at gmail.com


--- Comment #0 from josvanuden at gmail.com 2013-03-16 03:18:26 PDT ---
std.algorithm.setIntersection only accepts 2 ranges, although the documentation
says it accepts 2 or more. There's a static assert in the code that limits the
input to 2 ranges. Even the example on the webpage doesn't compile:

int[] a = [ 1, 2, 4, 5, 7, 9 ]; 
int[] b = [ 0, 1, 2, 4, 7, 8 ]; 
int[] c = [ 0, 1, 4, 5, 7, 8 ]; 
assert(equal(setIntersection(a, a), a)); 
assert(equal(setIntersection(a, b), [1, 2, 4, 7][])); 
assert(equal(setIntersection(a, b, c), [1, 4, 7][]));

(...)\dmd2\windows\bin\..\..\src\phobos\std\algorithm.d(10076): Error: static
assert  (3u == 2u) is false
(...)\dmd2\windows\bin\..\..\src\phobos\std\algorithm.d(10150):       
instantiated from here: SetIntersection!("a < b", int[], int[], int[])
test.d(16):        instantiated from here: setIntersection!("a < b",
int[],int[],int[])

Whether this limitation is temporary or permanent, I think the docs should
indicate that you cannot (for now) input more than 2 ranges.

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


More information about the Digitalmars-d-bugs mailing list