fork(3) download
  1. template <typename Ret, typename T, Ret(T::*mptr)()>
  2. Ret f() {
  3. T obj;
  4. return (obj.*mptr)();
  5. }
  6.  
  7. template <typename Ret, typename T>
  8. Ret g(Ret(T::*mptr)())
  9. {
  10. return f<Ret,T,mptr>();
  11. }
  12.  
  13. struct A {
  14. int a() { return 0; }
  15. };
  16.  
  17. int main() {
  18. return g(&A::a);
  19. }
Success #stdin #stdout 0.02s 2720KB
stdin
Standard input is empty
stdout
Standard output is empty