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

Method Put

common/values/value_builder.cc:1248–1266  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1246 }
1247
1248 absl::Status Put(Value key, Value value) const override {
1249 CEL_RETURN_IF_ERROR(CheckMapKey(key));
1250 CEL_RETURN_IF_ERROR(CheckMapValue(value));
1251 if (auto it = map_.find(key); ABSL_PREDICT_FALSE(it != map_.end())) {
1252 return DuplicateKeyError().ToStatus();
1253 }
1254 auto insertion = map_.insert({std::move(key), std::move(value)});
1255 ABSL_DCHECK(insertion.second);
1256 if (entries_trivially_destructible_) {
1257 entries_trivially_destructible_ =
1258 ArenaTraits<>::trivially_destructible(insertion.first->first) &&
1259 ArenaTraits<>::trivially_destructible(insertion.first->second);
1260 if (!entries_trivially_destructible_) {
1261 map_.get_allocator().arena()->OwnDestructor(
1262 const_cast<TrivialMutableMapValueImpl*>(this));
1263 }
1264 }
1265 return absl::OkStatus();
1266 }
1267
1268 void Reserve(size_t capacity) const override { map_.reserve(capacity); }
1269

Callers

nothing calls this directly

Calls 6

CheckMapKeyFunction · 0.85
CheckMapValueFunction · 0.85
DuplicateKeyErrorFunction · 0.85
endMethod · 0.45
ToStatusMethod · 0.45
arenaMethod · 0.45

Tested by

no test coverage detected