| 270 | // Name should point to a static constexpr string so the lambda capture is safe. |
| 271 | template <typename Type, typename Op> |
| 272 | std::function<Value(Type, Type, const google::protobuf::DescriptorPool* absl_nonnull, |
| 273 | google::protobuf::MessageFactory* absl_nonnull, |
| 274 | google::protobuf::Arena* absl_nonnull)> |
| 275 | WrapComparison(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 | // |
nothing calls this directly
no test coverage detected