fork(4) download
  1. #include <iostream>
  2.  
  3.  
  4. template<typename S>
  5. int add(S s) {
  6. return s.num + s.num2;
  7. }
  8.  
  9. struct Test{
  10. int num;
  11. int num2;
  12. };
  13.  
  14. int main() {
  15.  
  16. Test test;
  17.  
  18. test.num = 10;
  19. test.num2 = 20;
  20.  
  21. std::cout << add(test) << '\n';
  22. return 0;
  23. }
Success #stdin #stdout 0.02s 2680KB
stdin
Standard input is empty
stdout
30