AB
Size: a a a
AB
VK
#include <iostream>
struct S;
void (S::*foo_ptr)(void);
void (*bar_ptr)(void);
int main()
{
int a = sizeof(foo_ptr);
int b = sizeof(bar_ptr);
std::cout << "non-static member function pointer: " << a << std::endl;
std::cout << "function pointer: " << b << std::endl;
}
VK
VK
AB
A
VK
VK
AB
AK
AK
AK
A
AK
A pointer to member function is a pair as follows:
ptr:
For a non-virtual function, this field is a simple function pointer. (Under current base Itanium psABI conventions, that is a pointer to a GP/function address pair.) For a virtual function, it is 1 plus the virtual table offset (in bytes) of the function, represented as a ptrdiff_t. The value zero represents a NULL pointer, independent of the adjustment field value below.
adj:
The required adjustment to this, represented as a ptrdiff_t.
A
A
A
A
ЗВ
D
auto operator<=>(MyClass) = default;