fork download
  1. #include <iostream>
  2. #include <tuple>
  3.  
  4. template <typename T>
  5. inline const T& max (const T& a, const T& b){
  6. return a < b ? b : a;
  7. }
  8.  
  9. namespace BigMath{
  10. struct BigNumber{
  11. int one = 0;
  12. int two = 0;
  13. void print() {
  14. std::cout << "("<< one << ", " << two << ")" << std::endl;
  15. }
  16. operator int(){
  17. return 2;
  18. }
  19. };
  20.  
  21. bool operator<(const BigNumber& a, const BigNumber& b){
  22. return std::tie(a.one, a.two) < std::tie(b.one, b.two);
  23. }
  24. }
  25.  
  26. void f(int) {
  27. std::cout << "::f" << std::endl;
  28. }
  29.  
  30. namespace bla {
  31. using BigMath::BigNumber;
  32.  
  33. void f(const BigNumber&) {
  34. std::cout << "bla::foo" << std::endl;
  35. }
  36.  
  37. //bool max() {return true;};
  38.  
  39. void printBigger(const BigNumber& a, const BigNumber& b) {
  40. BigNumber x = max(a,b);
  41. x.print();
  42. (f)(a);
  43. f(a);
  44. }
  45. }
  46.  
  47. int main() {
  48. BigMath::BigNumber a;
  49. a.one = 3;
  50. a.two = 0;
  51. BigMath::BigNumber b;
  52. b.one = 2;
  53. b.two = 2;
  54.  
  55. bla::printBigger(a,b);
  56. // Bla bla;
  57. // bla.printBigger(a,b);
  58.  
  59. (f)(a);
  60. f(a);
  61.  
  62. return 0;
  63. }
Success #stdin #stdout 0.01s 5324KB
stdin
Standard input is empty
stdout
(3, 0)
bla::foo
bla::foo
::f
::f