fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. template<class T>
  5. void fun(T a){
  6. a();
  7. }
  8.  
  9. struct A{
  10. void operator()(){cout << "A() called" << endl;}
  11. };
  12.  
  13. int main(){
  14. fun(A());
  15. return 0;
  16. }
  17.  
Success #stdin #stdout 0s 3340KB
stdin
Standard input is empty
stdout
A() called