[Issue 11229] std.string.toLower is slow

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Mon May 9 11:46:17 PDT 2016


https://issues.dlang.org/show_bug.cgi?id=11229

--- Comment #8 from Jack Stouffer <jack at jackstouffer.com> ---
(In reply to Jon Degenhardt from comment #7)
> auto mapAsLowerCase(Range)(Range str)
>     if (isInputRange!Range && isSomeChar!(ElementEncodingType!Range) &&
>         !isConvertibleToString!Range)
> {
>     static if (ElementEncodingType!Range.sizeof < dchar.sizeof)
>     {
>         import std.utf : byDchar;
>         return str.byDchar.mapAsLowerCase;
>     }
>     else
>     {
>         import std.algorithm : map;
>         import std.uni : toLower;
>         
>         return str.map!(x => x.toLower);
>     }
> }

I attempted to replace asLowerCase with this, but it's blocked by
https://issues.dlang.org/show_bug.cgi?id=16005

--


More information about the Digitalmars-d-bugs mailing list