Today's programming challenge - How's your Range-Fu ?

H. S. Teoh via Digitalmars-d digitalmars-d at puremagic.com
Sat Apr 18 13:21:27 PDT 2015


On Sat, Apr 18, 2015 at 11:37:27AM -0700, Walter Bright via Digitalmars-d wrote:
> On 4/18/2015 11:29 AM, H. S. Teoh via Digitalmars-d wrote:
> >On Sat, Apr 18, 2015 at 10:53:04AM -0700, Walter Bright via Digitalmars-d wrote:
> >>On 4/18/2015 6:27 AM, H. S. Teoh via Digitalmars-d wrote:
> >>>One possible solution would be to modify std.uni.graphemeStride to
> >>>not allocate, since it shouldn't need to do so just to compute the
> >>>length of the next grapheme.
> >>
> >>That should be done. There should be a fixed maximum codepoint count
> >>to graphemeStride.
> >
> >Why? Scanning a string for a grapheme of arbitrary length does not
> >need allocation since you're just reading data. Unless there is some
> >required intermediate representation that I'm not aware of?
> 
> If there's no need for allocation at all, why does it allocate? This
> should be fixed.

AFAICT, the only reason it allocates is because it shares the same
underlying implementation as byGrapheme. There's probably a way to fix
this, I just don't have the time right now to figure out the code.


T

-- 
Маленькие детки - маленькие бедки.


More information about the Digitalmars-d mailing list