C++ Logo

std-proposals

Advanced search

Re: [std-proposals] Allow conversion of memfunc pointers to func pointers

From: Frederick Virchanza Gotham <cauldwell.thomas_at_[hidden]>
Date: Thu, 11 Jan 2024 00:04:56 +0000
On Wed, Jan 10, 2024 at 2:21 PM Frederick Virchanza Gotham wrote:
>
> Looking at your paper, I've been able to implement the following code of yours:
>
> Derived derived;
> void (Base::*bmfp1)() = &Base::some_virtual_function direct;
>
> in the following GodBolt on GNU g++:
>
> https://godbolt.org/z/1cqbbYfdq


Surprisingly, it also works with multiple inheritance -- somehow the
'this' pointer gets correctly adjusted but I can't see where that
happens.

GodBolt: https://godbolt.org/z/TvK5Y7aWh

Received on 2024-01-11 00:05:07