splitter, compilation issue
Adam D. Ruppe via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Tue Oct 27 15:33:31 PDT 2015
On Tuesday, 27 October 2015 at 22:18:55 UTC, sigod wrote:
> P.S. Maybe I should repost my question on SO? I really thought
> it was a bug, so I posted it here.
You could, but I'd say the same thing there - it is no bug, the
algorithm legitimately needs that functionality to split
successfully. At the same time, filter legitimately needs to
/drop/ that functionality to work efficiently.
So the error kinda sucks (maybe i should write this as a tip,
whenever you see that pattern, adding a .array can work around
it), but it isn't a bug.
The reason splitter doesn't try to automatically buffer or
something like that is that std.algorithm tries to be as low cost
as possible in all cases, and asks you to be aware of and pay the
cost when it needs to occur.
So if it needs a buffer and can't get one for free, it fails to
compile, so you are aware of the problem and can provide one that
works best for you (or just stick in .array somewhere to do an
easy, generic solution)
More information about the Digitalmars-d-learn
mailing list