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: Wed, 10 Jan 2024 14:21:41 +0000
On Fri, Jan 5, 2024 at 1:22 PM Jarrad Waterloo wrote:
>
> https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2022/p2603r1.html
>
> My motivations were 2 part.


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

It took me hours to settle on that solution. The next trick would be
making it 'consteval'.

Received on 2024-01-10 14:21:53