Proposal: takeFront and takeBack

Timon Gehr timon.gehr at gmx.ch
Wed Jul 4 04:56:29 PDT 2012


On 07/04/2012 12:50 PM, deadalnix wrote:
> Le 04/07/2012 06:32, Jonathan M Davis a écrit :
>> Okay, given the fact that takeFront wouldn't work with ranges like
>> std.stdio.ByLine, the code as proposed won't work. So, here's an adjusted
>> proposal:
>>
>> https://github.com/jmdavis/phobos/commit/14b88d9d5528f8736ae6014013bba82367e83620
>>
>>
>> As suggested, I renamed takeFront and takeBack to consumeFront and
>> consumeBack
>> respectively, but now they're in std.array and only apply to arrays.
>>
>> hasConsume has been added to std.range and tests whether a particular
>> range
>> defines consumeFront (and if it's a bidirectional range, whether it
>> defines
>> consumeBack).
>>
>
> I don't think this is a good idea.
> ...

+1.


More information about the Digitalmars-d mailing list