fork(3) download
  1. #include <iostream>
  2. #include <list>
  3. using namespace std;
  4.  
  5. template<class T> struct funWrapper {
  6. T my_function() {
  7. cout << "normal" << endl;
  8. return 0;
  9. }
  10. };
  11.  
  12. template<class T> struct funWrapper<std::list<T>> {
  13. std::list<T> my_function() {
  14. cout << "stdlist";
  15. return std::list<T>();
  16. }
  17. };
  18.  
  19.  
  20.  
  21. int main() {
  22. funWrapper<int> obj;
  23. obj.my_function();
  24.  
  25. funWrapper<std::list<int>> obj2;
  26. obj2.my_function();
  27. return 0;
  28. }
Success #stdin #stdout 0s 3296KB
stdin
Standard input is empty
stdout
normal
stdlist