splitter, compilation issue

Adam D. Ruppe via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Tue Oct 27 14:55:16 PDT 2015


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.


More information about the Digitalmars-d-learn mailing list