Created
July 23, 2011 12:10
-
-
Save hadronized/1101358 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> // std::cout / std::endl; | |
using namespace std; | |
template <class Policy> | |
struct foo : Policy { | |
int _a; | |
foo(void) : | |
Policy(this) { | |
cout << "In foo ctor ..." << endl; | |
} | |
~foo(void) { | |
} | |
void say_hello(void) const { | |
cout << "Hello, world!" << endl; | |
} | |
}; | |
struct print_ctor_policy { | |
print_ctor_policy(foo<print_ctor_policy> *p) { | |
p->_a = 4; | |
cout << p->_a << endl; | |
p->say_hello(); | |
} | |
}; | |
typedef foo<print_ctor_policy> foobar2_t; | |
int main() { | |
cout << "test" << endl; | |
foobar2_t omg; | |
return 0; | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment