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

Function WrapComparison

runtime/standard/equality_functions.cc:272–290  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

270// Name should point to a static constexpr string so the lambda capture is safe.
271template <typename Type, typename Op>
272std::function<Value(Type, Type, const google::protobuf::DescriptorPool* absl_nonnull,
273 google::protobuf::MessageFactory* absl_nonnull,
274 google::protobuf::Arena* absl_nonnull)>
275WrapComparison(Op op, absl::string_view name) {
276 return [op = std::move(op), name](
277 Type lhs, Type rhs,
278 const google::protobuf::DescriptorPool* absl_nonnull descriptor_pool,
279 google::protobuf::MessageFactory* absl_nonnull message_factory,
280 google::protobuf::Arena* absl_nonnull arena) -> Value {
281 absl::optional<bool> result = op(lhs, rhs);
282
283 if (result.has_value()) {
284 return BoolValue(*result);
285 }
286
287 return ErrorValue(
288 cel::runtime_internal::CreateNoMatchingOverloadError(name));
289 };
290}
291
292// Helper method
293//

Callers

nothing calls this directly

Calls 4

ErrorValueFunction · 0.85
BoolValueClass · 0.50
has_valueMethod · 0.45

Tested by

no test coverage detected