[challenge] can you break wstring's back?

spir denis.spir at gmail.com
Wed Nov 24 07:04:08 PST 2010


On Tue, 23 Nov 2010 22:08:04 -0500
"Steven Schveighoffer" <schveiguy at yahoo.com> wrote:

> However, there is only one back() function for narrow strings which  
> supposedly handles both char[] and wchar[].

If the same logic is supposed tell the nr of code units of char & dchar then it is certainly a bug. 

>  It looks like it will parse  
> 1, 2, 3, or 4 elements depending on the bit pattern, and it's only looking  
> at the least significant 8 bits of the elements to determine this.  Does  
> this make sense for wstring?

This is what to do for utf8 <-> recomposing a whole code point / char from variable nr of code units.
Stephan answered about utf16 <-> wchar.

>  I would think the wstring has a different  
> way of decoding data than the string, otherwise why the two different  
> popBacks?

You are right.


Denis
-- -- -- -- -- -- --
vit esse estrany ☣

spir.wikidot.com



More information about the Digitalmars-d mailing list