I need my struct to convertable to 'wchar'
H. S. Teoh
hsteoh at qfbox.info
Tue Jun 17 21:39:59 UTC 2025
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
--
If you want to solve a problem, you need to address its root cause, not just its symptoms. Otherwise it's like treating cancer with Tylenol...
More information about the Digitalmars-d
mailing list