typedef behavior

Simen Kjærås simen.kjaras at gmail.com
Sun Feb 11 15:18:11 UTC 2018


On Sunday, 11 February 2018 at 01:32:52 UTC, Alex wrote:
> On Saturday, 10 February 2018 at 02:55:26 UTC, Alex wrote:
>
> bug filed
>
> https://issues.dlang.org/show_bug.cgi?id=18416

Basically, Typedef looks like this:

struct Typedef(T) {
     T _payload;
     // Forward method calls, member access, etc, to _payload.
}

If T looks like this:

struct T {
     static int[3] arr;
     void foo() { arr[0]++; }
}

How is Typedef supposed to wrap T.foo in such a way that it uses 
a different arr depending on whether it's called from the Typedef 
or from T?

--
   Simen


More information about the Digitalmars-d-learn mailing list