d5ddd14ee1
Add MapInsertOrReplace<>() to insert a key-value pair into a map if the key is not already present, or replace the existing value for key if the key is present. The original value can optionally be returned to the caller in this case. Map insertions now use either MapInsertOrReplace<>() or std::map<>::insert() directly. Use MapInsertOrReplace<>() when the map should be updated to contain a mapping from a key to a value regardless of whether the key is already present. Use std::map<>::insert() to insert a mapping from a key to a value without replacing any existing mapping from a key, if present. If it is important to know whether an existing mapping from a key was present, use the returned std::pair<>.second. If it is important to know the existing value, use the returned std::pair<>.first->second. This change has a slight positive impact on performance. TEST=crashpad_util_test MapInsert.MapInsertOrReplace and others BUG= R=scottmg@chromium.org Review URL: https://codereview.chromium.org/1044273002 |
||
---|---|---|
.. | ||
mac | ||
crashpad_database_util.ad | ||
crashpad_database_util.cc | ||
generate_dump.ad | ||
generate_dump.cc | ||
tool_support.cc | ||
tool_support.h | ||
tools.gyp |