MCPcopy Create free account
hub / github.com/cel-expr/cel-cpp / IntCompareVisitor

Class IntCompareVisitor

internal/number.h:150–165  ·  view source on GitHub ↗

Implement generic numeric comparison against int value. Delegates to uint / double if either value is uint / double.

Source from the content-addressed store, hash-verified

148// Implement generic numeric comparison against int value.
149// Delegates to uint / double if either value is uint / double.
150struct 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
167struct CompareVisitor {
168 explicit constexpr CompareVisitor(NumberVariant rhs) : rhs(rhs) {}

Callers 1

operator()Method · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected