std.algorithm.remove and principle of least astonishment
Andrei Alexandrescu
SeeWebsiteForEmail at erdani.org
Mon Nov 22 10:55:11 PST 2010
On 11/22/10 4:01 AM, Rainer Deyke wrote:
> I see, foreach still iterates over code units by default. Of course,
> this means that foreach over ranges doesn't work with strings, which in
> turn means that algorithms that use foreach over ranges are broken.
> Observe:
>
> import std.stdio;
> import std.algorithm;
>
> void main() {
> writeln(count!("true")("日本語")); // Three characters.
> }
>
> Output (compiled with Digital Marse D Compiler v2.050):
> 9
Thanks.
http://d.puremagic.com/issues/show_bug.cgi?id=5257
Andrei
More information about the Digitalmars-d
mailing list