I need my struct to convertable to 'wchar'

Zoda zoda at vuhuv.com
Wed Jun 18 12:27:18 UTC 2025


On Tuesday, 17 June 2025 at 21:39:59 UTC, H. S. Teoh wrote:
> On Tue, Jun 17, 2025 at 07:36:27PM +0000, Zoda via 
> Digitalmars-d wrote:
>> On Tuesday, 17 June 2025 at 19:31:30 UTC, H. S. Teoh wrote:
> [...]
>> > ```d
>> > struct ColoredChar {
>> > 	int[3] rgb;
>> > 	wchar ch;
>> > 	alias ch this;
>> > }
>> > ```
> [...]
>> Oh thanks thats works just fine now. Thanks for you answer.
>
> Glad it works.
>
> But you should know that `alias this` is generally regarded as 
> an anti-pattern; it's great for a quick hack to get things 
> done, but in the long term, you should probably refactor your 
> code to avoid it.
>
>
> T

I'm currently working on refactoring my code. Thanks again, Zoda.


More information about the Digitalmars-d mailing list