Why are template alias parameters broken?
Menshikov
mensikovk817 at gmail.com
Fri Aug 27 20:07:06 UTC 2021
On Friday, 27 August 2021 at 19:32:49 UTC, Steven Schveighoffer
wrote:
> On 8/27/21 3:14 PM, Steven Schveighoffer wrote:
>
>> To work around, you can do:
>>
>> ```d
>> template Foo(alias var)
>> {
>> void inc() {var.a++}
>> }
>> ```
>>
>> and then pass `v` instead of `v.a`.
>
> Another possible workaround:
>
> ```d
> auto v = V(4);
> ref int a() { return v.a; }
> alias foo = Foo!a;
> foo.inc();
> ```
>
> -Steve
Thanks
More information about the Digitalmars-d
mailing list