How exactly does Tuple work?
Adam D. Ruppe
destructionator at gmail.com
Sun Nov 8 13:10:33 UTC 2020
On Sunday, 8 November 2020 at 10:03:46 UTC, Jan Hönig wrote:
> Is there some recourse, which explains the `alias <something>
> this`?
If your object is used in a way that doesn't compile, the
compiler will change `obj` to `obj.whatever_alias_this_is` and
try again.
So say you have
struct S {
int a;
alias a this;
}
S obj;
obj += 5;
It will see that obj +=5 doesn't compile on its own, but it has
alias a this so it changes `obj` to `obj.a` and tries again.
So `obj.a += 5;` is the end result.
More information about the Digitalmars-d-learn
mailing list