Overhauling the notion of output range

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Mon Jul 12 10:58:23 PDT 2010


On 07/12/2010 12:55 PM, Steven Schveighoffer wrote:
> On Mon, 12 Jul 2010 13:43:18 -0400, torhu <no at spam.invalid> wrote:
>
>> On 12.07.2010 18:48, Steven Schveighoffer wrote:
>> [...]
>>> So what happens when you call put(r, e) for one of these output
>>> classes? Instead of just calling add(e), it calls (add((&e)[0..1]))
>>> which in turn goes through some needless loop, which then ends up
>>> calling add(e). I don't see why this is preferable.
>>
>> put(r, e) prefers to call r.put(e) for single element adds. Doesn't
>> that take care of it?
>
> No, dcollections doesn't define put. But you could take a delegate to
> add. The question is, why the prejudice against the single element
> version when using a delegate as an output range?
>
> The fact that an output range can define a put function that takes a
> single element, but you can't use a delegate just makes no sense to me.
>
> -Steve

Efficiency?

Andrei


More information about the Digitalmars-d mailing list