fork(1) download
  1. #include <iostream>
  2. #include <type_traits>
  3.  
  4. struct C{
  5. int f()
  6. {
  7. return 5;
  8. }
  9. } c;
  10.  
  11. template<typename T, T t, typename S, S* s> void callCf()
  12. {
  13. std::cout << (s->*t)();
  14. }
  15.  
  16. int main()
  17. {
  18. using tC = std::remove_reference_t<decltype(c)>;
  19. callCf<decltype(&tC::f), &tC::f, tC, &c>();
  20. return 0;
  21. }
Success #stdin #stdout 0s 4548KB
stdin
Standard input is empty
stdout
5