Overhauling the notion of output range
Steven Schveighoffer
schveiguy at yahoo.com
Mon Jul 12 10:55:22 PDT 2010
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
More information about the Digitalmars-d
mailing list