fork download
  1. #include <string>
  2.  
  3. template<typename T> struct Const {
  4. explicit Const(T val) : value(val) {}
  5. T value;
  6. };
  7.  
  8. template<typename T> struct Var {
  9. explicit Var(const std::string &n) : name(n) {}
  10.  
  11. std::string name;
  12. };
  13.  
  14. template<typename L, typename R> struct Greater {
  15. Greater(L lhs, R rhs) : left(lhs), right(rhs) {}
  16.  
  17. L left;
  18. R right;
  19. };
  20.  
  21. //
  22. template<typename L>
  23. Greater<L, Const<int> > operator > (L lhs, int rhs) {
  24. return Greater<L, Const<int> >(lhs, Const<int>(rhs));
  25. }
  26.  
  27.  
  28. //
  29. template<typename R>
  30. Greater<Const<int>, R> operator > (int lhs, R rhs) {
  31. return Greater<Const<int>, R>(Const<int>(lhs), rhs);
  32. }
  33.  
  34. Var<double> d("d");
  35.  
  36. int main(int argc, char *argv[]) {
  37. d > 10;
  38. return 0;
  39. }
Success #stdin #stdout 0s 3468KB
stdin
Standard input is empty
stdout
Standard output is empty