Odd behaviour of std.range

Adam D Ruppe destructionator at gmail.com
Tue Feb 22 12:53:03 UTC 2022

On Tuesday, 22 February 2022 at 12:48:21 UTC, frame wrote:
> What am I missing here? Is this some UTF conversion issue?

`front` is a phobos function. Phobos treats char as special than 
all other arrays.

It was a naive design flaw that nobody has the courage to fix.

Either just don't use phobos on strings (the language itself 
treats them sane, you can foreach etc), use the .representation 
member on them before putting it into any range, or ask why 
you're doing range operations on a string in the first place and 
see if the behavior actually kinda makes sense for you.

More information about the Digitalmars-d-learn mailing list