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

Function SetsIntersects

extensions/sets_functions.cc:63–82  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

61}
62
63absl::StatusOr<Value> SetsIntersects(
64 const ListValue& list, const ListValue& sublist,
65 const google::protobuf::DescriptorPool* absl_nonnull descriptor_pool,
66 google::protobuf::MessageFactory* absl_nonnull message_factory,
67 google::protobuf::Arena* absl_nonnull arena) {
68 bool exists = false;
69 CEL_RETURN_IF_ERROR(list.ForEach(
70 [&](const Value& list_element) -> absl::StatusOr<bool> {
71 CEL_ASSIGN_OR_RETURN(auto contains,
72 sublist.Contains(list_element, descriptor_pool,
73 message_factory, arena));
74 // Treat contains return CEL error as false for the sake of
75 // intersecting.
76 exists = contains->Is<BoolValue>() && contains.GetBool().NativeValue();
77 return !exists;
78 },
79 descriptor_pool, message_factory, arena));
80
81 return BoolValue(exists);
82}
83
84absl::StatusOr<Value> SetsEquivalent(
85 const ListValue& list, const ListValue& sublist,

Callers

nothing calls this directly

Calls 4

BoolValueClass · 0.50
ForEachMethod · 0.45
NativeValueMethod · 0.45
GetBoolMethod · 0.45

Tested by

no test coverage detected