fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. class MyClass {
  5. int foo0() { return 0; }
  6. int foo1() { return 1; }
  7. template<int (MyClass::*fun)()> void test0() { const auto i = (this->*fun)(); }
  8. void test1() { test0<&MyClass::foo0>(); }
  9. void test2() {
  10. const auto fun0 = &MyClass::test0<&MyClass::foo0>;
  11. const auto fun1 = &MyClass::test0<&MyClass::foo1>;
  12. (this->*fun0)();
  13. (this->*fun1)();
  14. }
  15. };
  16.  
  17. int main() {
  18. // your code goes here
  19. return 0;
  20. }
Success #stdin #stdout 0.01s 5592KB
stdin
Standard input is empty
stdout
Standard output is empty