[D-runtime] foreach (dchar c; s) is too slow

Jonathan M Davis jmdavisProg at gmx.com
Tue Oct 1 11:13:14 PDT 2013


On Tuesday, October 01, 2013 19:47:41 Jacob Carlborg wrote:
> "foreach(c ; s)" is the same as
> foreach over dchar. Which is an even more hidden pitfall.

foreach(c; s)

iterates over the code unit type of the string, which is only dchar if it's an 
array of dchar. You only get decoding and conversion to other character types 
if you explicitly give a different character type.

- Jonathan M Davis


More information about the D-runtime mailing list