Skip to content

Instantly share code, notes, and snippets.

@cengiz-io
Last active August 29, 2015 14:07
Show Gist options
  • Save cengiz-io/bb40f9e3139e329e3b7f to your computer and use it in GitHub Desktop.
Save cengiz-io/bb40f9e3139e329e3b7f to your computer and use it in GitHub Desktop.
What the heck is this?
#include <iostream>
struct bar {
int i;
};
struct foo {
int bar::* p;
};
int main() {
bar b;
b.i = 42;
foo f;
f.p = &bar::i;
int bar::* foo::* ptr = &foo::p;
std::cout << (b.*(f.*ptr));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment