December 22, 2013 [Issue 9734] setIntersection accepts only 2 ranges, but documentation says otherwise | ||||
---|---|---|---|---|
| ||||
https://d.puremagic.com/issues/show_bug.cgi?id=9734 Jakob Ovrum <jakobovrum@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED CC| |jakobovrum@gmail.com Resolution| |FIXED --- Comment #2 from Jakob Ovrum <jakobovrum@gmail.com> 2013-12-21 23:01:20 PST --- (In reply to comment #0) > 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. https://github.com/D-Programming-Language/phobos/pull/1796 -- Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
Copyright © 1999-2021 by the D Language Foundation