Major performance problem with std.array.front()

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Fri Mar 7 13:53:09 PST 2014


On 3/7/14, 11:28 AM, Dmitry Olshansky wrote:
> 07-Mar-2014 23:11, Andrei Alexandrescu пишет:
>> On 3/7/14, 9:24 AM, Vladimir Panteleev wrote:
>>>> 5. Implement new std.array.front for strings that doesn't decode.
>>>
>>> Until then, how will people use strings with algorithms when they mean
>>> to use them per-byte? A .raw property which casts to ubyte[]?
>>
>> There's no "until then".
>>
>> A current ".representation" property already exists that casts all
>> string types appropriately.
>
> There is however a big glaring failure: std.algorithm specialized for
> char[], wchar[] but not for any RandomAccessRange!char or
> RandomAccessRange!wchar.

I agree that's an issue. Back in the day when this was a choice I 
decided to consider only char[] and friends "UTF strings". There was 
room for more generality but I didn't know of any use cases that would 
ask for them. It's possible I was wrong, but the option to generalize is 
still open today.

Andrei




More information about the Digitalmars-d mailing list