fork download
  1. #include <limits>
  2. #include <iostream>
  3.  
  4. class UnixTime;
  5.  
  6. class SmallUnixTime
  7. {
  8. public:
  9. int Value;
  10.  
  11. explicit SmallUnixTime(int value = 0) : Value(value)
  12. {
  13. }
  14.  
  15. operator bool() const
  16. {
  17. return this->Value;
  18. }
  19. };
  20.  
  21. class UnixTime
  22. {
  23. public:
  24. long long Value;
  25.  
  26. explicit UnixTime(long long value = 0LL) : Value(value)
  27. {
  28. }
  29.  
  30. operator SmallUnixTime() const
  31. {
  32. SmallUnixTime sut(this->Value <= std::numeric_limits<int>::max() ? this->Value : 0);
  33. return sut;
  34. }
  35.  
  36. operator bool() const
  37. {
  38. return this->Value;
  39. }
  40. };
  41.  
  42. SmallUnixTime newClusters(int)
  43. {
  44. SmallUnixTime sut(std::numeric_limits<int>::max());
  45. return sut;
  46. }
  47.  
  48. UnixTime newSeed(int)
  49. {
  50. UnixTime ut(std::numeric_limits<int>::max() + 1LL);
  51. return ut;
  52. }
  53.  
  54. int main() {
  55. int Sp = 0;
  56.  
  57. int m_seedsfilter = 2;
  58.  
  59. {
  60. bool good;
  61. bool bad = !m_seedsfilter ? good=true
  62. : m_seedsfilter==1 ? good=newClusters(Sp)
  63. : good=newSeed(Sp);
  64.  
  65. std::cout << good << " " << bad << std::endl;
  66. }
  67.  
  68. {
  69. bool good;
  70. bool bad = good = !m_seedsfilter ? true
  71. : m_seedsfilter==1 ? newClusters(Sp)
  72. : newSeed(Sp);
  73.  
  74. std::cout << good << " " << bad << std::endl;
  75. }
  76.  
  77. return 0;
  78. }
Success #stdin #stdout 0s 3296KB
stdin
Standard input is empty
stdout
1 1
0 0