inplace_merge, nWayUnion

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Mon Aug 30 12:19:38 PDT 2010


On 8/30/10 14:06 PDT, bearophile wrote:
> Andrei Alexandrescu:
>> My point is you need to understand that you are making contradictory
>> requests.
>
> I understand your point, but I think you are wrong. I think that the usage and semantics of a nWayUnion(r1, r2, ...) are simple to understand and use (regardless the complexity of its signature).
>
> You use it as:
> foreach (x; nWayUnion(r1, r2))
> Or as:
> array(nWayUnion(r1, r2, r3))
> etc. This is a natural enough.
>
> Bye,
> bearophile

I'd be indeed wrong to claim that. What I was saying is that in a past 
bug report you complained that find() is too hard to understand. That 
was because find() supported things like heterogeneous ranges and 
finding more things than one in a single-pass manner. Making nWayUnion 
accept heterogeneous ranges would no doubt increase its implementation 
complexity - probably worth it given the increased leverage. All I'm 
saying is, please remember that solutions that are at the same time 
simpler and more general are in short supply.

Andrei


More information about the Digitalmars-d mailing list