Ready for review: new std.uni
    Dmitry Olshansky 
    dmitry.olsh at gmail.com
       
    Sat Jan 12 23:00:50 PST 2013
    
    
  
13-Jan-2013 03:39, Walter Bright пишет:
> On 1/11/2013 11:31 AM, Dmitry Olshansky wrote:
>> And documentation:
>> http://blackwhale.github.com/phobos/uni.html
>
> struct InversionList:
>
>
> length() returns "number of characters", while "empty()" returns true if
> there are no codepoints.
>
> Aren't the two redundant?
Containers commonly have both. But maybe I should kill length on 
different grounds because it's computed by walking the array of 
intervals [a, b) and summing up (b-a) lengths. It's O(N).... ouch.
The only problem is that then it's not at all obvious that length is 
better calculated via:
reduce!"a + (b[1] - b[0])"(set.byInterval, 0);
vs
walkLength(set.byChar);
where the latter may take enormous time to finish on common sets.
(damn it should by DChar at least)
> And should it be characters or codepoints?
Codepoints, everything works on codepoints, that is dchars. A character 
is a Grapheme. So all mentions of character that slipped through got to 
be fixed.
-- 
Dmitry Olshansky
    
    
More information about the Digitalmars-d
mailing list