I need my struct to convertable to 'wchar'
Zoda
zoda at vuhuv.com
Tue Jun 17 19:36:27 UTC 2025
On Tuesday, 17 June 2025 at 19:31:30 UTC, H. S. Teoh wrote:
> On Tue, Jun 17, 2025 at 07:15:33PM +0000, Zoda via
> Digitalmars-d wrote:
>> Hi, I need my struct to convertable to 'wchar' my struct looks
>> like this
>> ```d
>> struct ColoredChar {
>> int[3] rgb;
>> wchar ch;
>> }
>>
>> // Existing functions looks like this
>> void doSomething(wchar ch) {
>> ...
>> }
>> ```
>> i don't want my existing functions to break so i need my
>> struct to be
>> convertable to a 'wchar', how can achieve this?
> [...]
>
> ```d
> struct ColoredChar {
> int[3] rgb;
> wchar ch;
> alias ch this;
> }
> ```
>
>
> --T
Oh thanks thats works just fine now. Thanks for you answer.
More information about the Digitalmars-d
mailing list