splitter, compilation issue

Ali Çehreli via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Tue Oct 27 14:58:40 PDT 2015


On 10/27/2015 02:55 PM, Adam D. Ruppe wrote:
> On Tuesday, 27 October 2015 at 21:45:10 UTC, Ali Çehreli wrote:
>> split's documentation says that it requires a ForwardRange but the
>> output of filter is an InputRange. (I can't imagine now why split has
>> that requirement.)
>
> You need to .save at the beginning so when you hit the split point, it
> can present the whole string as front. You don't know if you've hit the
> split point until after you've done a fair amount of popFront calls, so
> if you haven't saved it before, it is impossible to return the first
> element before the splitter string.

I knew that! :p

Ali



More information about the Digitalmars-d-learn mailing list