bearophile wrote:
The most general input is a lazy range of lazy sorted ranges, in this situation the nWayUnion has to first "duplicate" it into an eager array of such ranges, and then turn it into an heap as before. I guess in most situations you don't have more than thausands of such sorted iterables, so cerating such temporary array isn't too much bad. (nWayUnion may also have a small fixed size array of pointers/indexes on the stack, for the simple case of an array of 3-5 arrays).
The policy of std.algorithm is to not surreptitiously allocate memory if it can help it. So the user is left responsible with creating a range of ranges with random access.
Andrei
