fork(2) download
  1. #include <iostream>
  2.  
  3. //function1
  4. template<typename returnType>
  5. returnType call()
  6. {
  7. //function with return type
  8. std::cout << "function1\n";
  9. return returnType();
  10. }
  11.  
  12. //function2
  13. template<>
  14. void call<void>()
  15. {
  16. //function without return type
  17. std::cout << "function2\n";
  18. }
  19.  
  20. int main() {
  21. call<int>(); //call function1
  22. call<void>(); //call function2
  23. }
Success #stdin #stdout 0s 3340KB
stdin
Standard input is empty
stdout
function1
function2