Better way to achieve the following

Tejas notrealemail at gmail.com
Tue Jun 21 17:35:00 UTC 2022


On Tuesday, 21 June 2022 at 17:09:28 UTC, JG wrote:
> Suppose we are often writing something like
> ```d
> theFirstName[theFirstIndex].theSecondName[theSecondIndex].thirdName[theThirdIndex]=x;
> ```
> One would like to something like
> ```d
> alias shortName = 
> theFirstName[theFirstIndex].theSecondName[theSecondIndex].thirdName[theThirdIndex];
> shortName = x;
> ```
> but you can't alias an expression.
>
> [...]

Maybe check out `std.meta.Alias`?

https://dlang.org/phobos/std_meta.html#.Alias


More information about the Digitalmars-d-learn mailing list