Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- struct Foo {
- template <typename T = Foo>
- static T *create() {
- return new T();
- }
- };
- struct Bar : Foo {};
- struct Baz : Foo {};
- int main() {
- Foo::create();
- Bar::create<Bar>();
- return 0;
- }
- template <typename T = this_type>
Add Comment
Please, Sign In to add comment