Skip to content

Instantly share code, notes, and snippets.

@nicolas17
Last active August 29, 2015 14:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nicolas17/c4b3b692ad69f5d9a9c1 to your computer and use it in GitHub Desktop.
Save nicolas17/c4b3b692ad69f5d9a9c1 to your computer and use it in GitHub Desktop.
class Quux;
class Foo {
public:
void (Quux::*ptr)();
};
int main() {
Foo x;
printf("The pointer to member function is %d bytes\n", sizeof(x.ptr));
}
//output: The pointer to member function is 16 bytes
class Quux {};
class Foo {
public:
void (Quux::*ptr)();
};
int main() {
Foo x;
printf("The pointer to member function is %d bytes\n", sizeof(x.ptr));
}
//output: The pointer to member function is 4 bytes
class Quux;
class Foo {
public:
void (Quux::*ptr)();
};
class Quux{};
int main() {
Foo x;
printf("The pointer to member function is %d bytes\n", sizeof(x.ptr));
}
//output: The pointer to member function is 16 bytes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment