Last active
February 9, 2019 18:24
-
-
Save udaken/cfc6805f1100d9dd0b6d748d42e3d307 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 <stdio.h> | |
| template <class T, void (T::* f)()> | |
| struct Foo | |
| { | |
| void func(T& obj) | |
| { | |
| (obj.*f)(); | |
| } | |
| }; | |
| struct A | |
| { | |
| template <int n> | |
| void func() | |
| { | |
| printf("%d\n",n); | |
| }; | |
| }; | |
| int main(int argc, char* argv[]) | |
| { | |
| A a; | |
| Foo<A, &A::func<0> > f0; | |
| f0.func(a); | |
| Foo<A, &A::func<1> > f1; | |
| f1.func(a); | |
| return 0; | |
| } | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment