Function-pointer valued enums

Steven Schveighoffer schveiguy at gmail.com
Sat Jan 23 18:35:21 UTC 2021


On 1/23/21 1:15 PM, mw wrote:
> On Saturday, 23 January 2021 at 06:13:03 UTC, tsbockman wrote:
>> On Saturday, 23 January 2021 at 00:21:25 UTC, H. S. Teoh wrote:
>>> Amazingly, it works!  Did you know that in D, enums can be 
>>> function-pointer-valued?  :-D
>>
>> Cool! Hopefully this doesn't have any weird pitfalls; I'm guessing it 
>> hasn't been tested much?
> 
> 
> How about non-static member functions?

&T.membername works. It's just, to call it you need to pair it with a T 
instance (which is possible).

-Steve


More information about the Digitalmars-d mailing list