fork download
  1. #include <iostream>
  2.  
  3. template<class From, class To, class Value>
  4. struct convert
  5. {
  6. static Value apply(Value value)
  7. {
  8. std::cout << "different\n";
  9. return value;
  10. }
  11. };
  12.  
  13. template<class From, class Value>
  14. struct convert<From,From,Value>
  15. {
  16. static Value apply(Value value)
  17. {
  18. std::cout << "same\n";
  19. return value;
  20. }
  21. };
  22.  
  23. int main()
  24. {
  25. convert<int,long,long>::apply(0L);
  26. convert<int,int,long>::apply(0L);
  27. }
Success #stdin #stdout 0s 3296KB
stdin
Standard input is empty
stdout
different
same