Casting between char[]/wchar[]/dchar[]

Hasan Aljudy hasan.aljudy at gmail.com
Sat Aug 5 15:52:19 PDT 2006



Derek Parnell wrote:
> On Sat, 5 Aug 2006 17:23:08 -0400, Jarrett Billingsley wrote:
> 
> 
>>import utf = std.utf;
>>
>>wchar[] utf16(char[] s)
>>{
>>    return utf.toUTF16(s);
>>}
>>
>>...
>>
>>char[] s = "hello";
>>wchar[] t = s.utf16;
>>
>> ;)
>>
>>Aren't first-array-param-as-a-property functions cool?
> 
> 
> Actually, that doesn't compile any more either.
> 
> Instead of 
> 
>    wchar[] t = s.utf16;
> 
> you have to code ...
> 
>    wchar[] t = s.utf16();
> 
> I'm sure it used to work the way you wrote it.
> 


even worse, if abc has property foo which is dchar[], then

     abc.foo.utf8();

will also fail; you'd have to use:
abc.foo().utf8();



More information about the Digitalmars-d mailing list