faster splitter

Andrei Alexandrescu via Digitalmars-d digitalmars-d at puremagic.com
Mon May 23 06:20:55 PDT 2016


On 05/23/2016 08:17 AM, qznc wrote:
> On Monday, 23 May 2016 at 12:01:52 UTC, qznc wrote:
>> Additionally, there is this weird special case for a bidirectional
>> range, which just adds unnecessary overhead. Is "remove dead code" a
>> good enough reason in itself for a PR?
>
> Forget the "dead code comment" it is a actually a missing feature. In
> the case the separator is a range and the input range is bidirectional,
> the splitter result should be bidirectional as well. It is not, because
> the implementation of back() and popBack() is missing, although some
> bookkeeping code for it exists.

Most uses are forward, so perhaps it's best to eliminate the 
bidirectional bookkeeping if it adds overhead, and confine those to a 
separate function e.g. splitterBidirectional. There is precedent for 
that in Phobos. -- Andrei


More information about the Digitalmars-d mailing list