Implement generic numeric comparison against int value. Delegates to uint / double if either value is uint / double.
| 148 | // Implement generic numeric comparison against int value. |
| 149 | // Delegates to uint / double if either value is uint / double. |
| 150 | struct IntCompareVisitor { |
| 151 | constexpr explicit IntCompareVisitor(int64_t v) : v(v) {} |
| 152 | |
| 153 | constexpr ComparisonResult operator()(double other) { |
| 154 | return Invert(DoubleCompareVisitor(other)(v)); |
| 155 | } |
| 156 | |
| 157 | constexpr ComparisonResult operator()(uint64_t other) { |
| 158 | return Invert(UintCompareVisitor(other)(v)); |
| 159 | } |
| 160 | |
| 161 | constexpr ComparisonResult operator()(int64_t other) { |
| 162 | return Compare(v, other); |
| 163 | } |
| 164 | int64_t v; |
| 165 | }; |
| 166 | |
| 167 | struct CompareVisitor { |
| 168 | explicit constexpr CompareVisitor(NumberVariant rhs) : rhs(rhs) {} |