alias Error: need 'this'

bomat Tempest_spam at gmx.de
Sun Mar 19 13:49:36 UTC 2023


On Sunday, 19 March 2023 at 12:29:19 UTC, Salih Dincer wrote:
> It is possible to achieve the convenience you want to achieve 
> in 2 ways. One of them is to use a static member but if not, to 
> use an alias inside the container.

Thanks for the suggested workaround, I can live with the `static` 
solution, I guess.

I still don't understand why it's necessary, though.
Since a `struct` is a value type and, as I understand it, stack 
allocated, what difference does it make to the compiler whether I 
alias `variableWithALongName` or `myStruct.memberWithALongName`?
Shouldn't it be the exact same underlying mechanism?

Thanks and regards
bomat


More information about the Digitalmars-d-learn mailing list