Given an object, how to call an alias to a member function on it?

Nick Treleaven nick at geany.org
Wed May 3 11:50:21 UTC 2023


On Wednesday, 3 May 2023 at 11:26:00 UTC, ag0aep6g wrote:
> On 03.05.23 13:13, Nick Treleaven wrote:
>> void fun(alias method)(C c)
>> {
>>      void delegate() dg = &c.method;
>>      dg();
>> }
>> 
>
> No, it doesn't. You're not using the alias. You're just 
> accessing `c.method` directly. If the actual method weren't 
> called "method", you'd get an error.

Sorry, you're right.


More information about the Digitalmars-d-learn mailing list