| 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 |
nothing calls this directly
no test coverage detected