What type does byGrapheme() return?

Robert M. Münch robert.muench at saphirion.com
Sat Jan 4 19:19:14 UTC 2020


On 2019-12-31 21:36:56 +0000, Steven Schveighoffer said:

> The fact that a Grapheme's return requires you keep the grapheme in 
> scope for operations seems completely incorrect and dangerous IMO (note 
> that operators are going to always have a ref this, even when called on 
> an rvalue). So even though using ref works, I think the underlying 
> issue here really is the lifetime problem.

Thanks for all the answers, pretty enlighting even I'm not sure I get 
everything 100%.

So, what to do for now? File a bug-report? What needs to be fixed?

I'm using the ref approach for now, in hope it will be OK for my 
use-case, which is converting a wstring to a grapheme[], alter the 
array, and map it back to a wstring. Sounds like a lot of porcessing 
for handling unicode text, but I don't think it gets a lot simpler than 
that.

-- 
Robert M. Münch
http://www.saphirion.com
smarter | better | faster



More information about the Digitalmars-d-learn mailing list