Pointers to non-static member functions!

David Nadlinger see at klickverbot.at
Wed Jun 8 04:42:04 PDT 2011


On 6/8/11 1:32 PM, Trass3r wrote:
> Am 08.06.2011, 10:00 Uhr, schrieb Daniel Murphy <yebblies at nospamgmail.com>:
>
>> Currently, this compiles:
>>
>> class A
>> {
>> void func() {}
>> }
>>
>> void main()
>> {
>> auto p = &A.func;
>> }
>>
>> In this case, typeof(p) is void function().
> ...
>> Does anybody think changing &ClassType.nonStaticMember to return void*
>> would be a bad idea?
>
> ??
> Shouldn't this just return a delegate?

Well, it returns a delegate, and &A.func gives you the function pointer 
part of the delegate. In my eyes, the question should rather be whether 
delegate.func should return a void*.

David


More information about the Digitalmars-d mailing list