fork(2) download
  1. #include <iostream>
  2.  
  3. template <typename T, typename U = T>
  4. class Reduce {
  5. public:
  6. Reduce(T *t, U *u) { std::cout << "Double argument.\n";}
  7. };
  8.  
  9. template <typename T>
  10. class Reduce<T,T> {
  11. public:
  12. Reduce(T *t) { std::cout << "Single argument.\n"; }
  13. };
  14.  
  15. int main()
  16. {
  17. Reduce<int, float> r(new int, new float);
  18. Reduce<int> r2(new int); // partial template specialization?
  19.  
  20. return 0;
  21. }
  22.  
Success #stdin #stdout 0.01s 2856KB
stdin
Standard input is empty
stdout
Double argument.
Single argument.