fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. template <typename T>
  5. struct foo {
  6. T bar;
  7. };
  8.  
  9. template <typename T>
  10. foo<T> func(T arg) {
  11. return { arg };
  12. }
  13.  
  14. int main() {
  15. cout << func(5).bar << endl
  16. << func(213.7).bar << endl
  17. << func("papa").bar << endl;
  18. return 0;
  19. }
Success #stdin #stdout 0s 4912KB
stdin
Standard input is empty
stdout
5
213.7
papa