Unicode handling comparison

Walter Bright newshound2 at digitalmars.com
Thu Nov 28 09:52:08 PST 2013


On 11/28/2013 5:24 AM, monarch_dodra wrote:
> Which operations are you thinking of in std.array that decode
> when they shouldn't?

front() in std.array looks like:

@property dchar front(T)(T[] a) @safe pure if (isNarrowString!(T[]))
{
     assert(a.length, "Attempting to fetch the front of an empty array of " ~ 
T.stringof);
     size_t i = 0;
     return decode(a, i);
}

So anytime I write a generic algorithm using empty, front, and popFront(), it 
decodes the strings, which is a large pessimization.


More information about the Digitalmars-d mailing list