std::map::operator[] is an inserting lookup: when the key is missing it default-constructs the mapped value, inserts the pair and returns a reference, so even a read can grow the container. That is why it has no const overload and why find() or at() is preferred for pure lookup, at() throwing std::out_of_range instead. The mapped type must therefore be default-constructible, and unordered_map follows exactly the same semantics.