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

           Summary: std.algorithm.nWayUnion(Tuple) too?
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: Phobos
        AssignedTo: [email protected]
        ReportedBy: [email protected]


--- Comment #0 from [email protected] 2013-02-27 15:12:43 PST ---
In some cases I have had to merge ranges of different type. So maybe for such
situations it's worth supporting nWayUnion of a Tuple of ranges:


import std.algorithm: nWayUnion, map;
import std.range: iota;
import std.typecons: tuple;
void main() {
    auto a = iota(10);
    auto b = [3, 6, 9];
    auto c = iota(11).map!q{a * a};
    auto r = nWayUnion(tuple(a, b, c));
}


Note: in all such of my usage cases the number of the ranges was limited, 2 or
3. So when the input of nWayUnion is a tuple I think there is no need for
nWayUnion to keep the ranges inside with a BinaryHeap.

- - - - - - - - - - - - - -

Current workaround, suggested by Ali �ehreli:

import std.algorithm: nWayUnion, map;
import std.range: iota, InputRange, inputRangeObject;
void main() {
    InputRange!int a = inputRangeObject(iota(10));
    InputRange!int b = inputRangeObject([3, 6, 9]);
    InputRange!int c = inputRangeObject(iota(11).map!q{a * a});
    auto r = nWayUnion([a, b, c]);
}

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

Reply via email to