std.algorithm.splitter on a string not always bidirectional
H. S. Teoh
hsteoh at quickfur.ath.cx
Fri Jan 22 00:51:24 UTC 2021
On Thu, Jan 21, 2021 at 05:43:37PM -0500, Steven Schveighoffer via Digitalmars-d-learn wrote:
> auto sp1 = "a|b|c".splitter('|');
>
> writeln(sp1.back); // ok
>
> auto sp2 = "a.b|c".splitter!(v => !isAlphaNum(v));
>
> writeln(sp2.back); // error, not bidirectional
>
> Why? is it an oversight, or is there a good reason for it?
[...]
Likely an oversight. But I wouldn't be surprised if there was some
surprising corner case for which this doesn't work / would have onerous
characteristics.
T
--
MSDOS = MicroSoft's Denial Of Service
More information about the Digitalmars-d-learn
mailing list