On Monday, 29 July 2013 at 21:13:54 UTC, Temtaime wrote:
I have a long named variable in a struct.
For example let's name that longnamedstruct.longnamedmember
I need to use that variable in many places of the code and i
cannot create the copy of it.
In c++ i can
auto &v = longnamedstruct.longnamedmember;
Now i can use v anywhere.
Why i cannot declare reference in D ? Or can i ?
I can make pointer to that, but it is workaround and it's need
to use variable dereferencing by * operator.
You can use alias:
alias v = longnamedstruct.longnamedmember;