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

Method operator<

common/function_descriptor.cc:55–96  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

53}
54
55bool FunctionDescriptor::operator<(const FunctionDescriptor& other) const {
56 if (impl_.get() == other.impl_.get()) {
57 return false;
58 }
59 if (name() < other.name()) {
60 return true;
61 }
62 if (name() != other.name()) {
63 return false;
64 }
65 if (receiver_style() < other.receiver_style()) {
66 return true;
67 }
68 if (receiver_style() != other.receiver_style()) {
69 return false;
70 }
71 auto lhs_begin = types().begin();
72 auto lhs_end = types().end();
73 auto rhs_begin = other.types().begin();
74 auto rhs_end = other.types().end();
75 while (lhs_begin != lhs_end && rhs_begin != rhs_end) {
76 if (*lhs_begin < *rhs_begin) {
77 return true;
78 }
79 if (!(*lhs_begin == *rhs_begin)) {
80 return false;
81 }
82 lhs_begin++;
83 rhs_begin++;
84 }
85 if (lhs_begin == lhs_end && rhs_begin == rhs_end) {
86 // Neither has any elements left, they are equal.
87 return false;
88 }
89 if (lhs_begin == lhs_end) {
90 // Left has no more elements. Right is greater.
91 return true;
92 }
93 // Right has no more elements. Left is greater.
94 ABSL_ASSERT(rhs_begin == rhs_end);
95 return false;
96}
97
98} // namespace cel

Callers

nothing calls this directly

Calls 6

nameFunction · 0.50
getMethod · 0.45
nameMethod · 0.45
receiver_styleMethod · 0.45
beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected