diff options
author | Jacques Lucke <jacques@blender.org> | 2020-06-18 19:16:51 +0300 |
---|---|---|
committer | Jacques Lucke <jacques@blender.org> | 2020-06-18 19:18:19 +0300 |
commit | 52b8d668f4d3d0a841313b678027a2d6af2fbc37 (patch) | |
tree | fbebc123c8929c2d36ba72b0e1638daed4c93c99 /source/blender/depsgraph/intern/builder/deg_builder_map.cc | |
parent | 44f785266012cfc399f29d28f13717a317e7a348 (diff) |
Depsgraph: use blender::Map instead of std::map
We decided to use our own map data structure in general for better
readability and performance.
Reviewers: sergey
Differential Revision: https://developer.blender.org/D7987
Diffstat (limited to 'source/blender/depsgraph/intern/builder/deg_builder_map.cc')
-rw-r--r-- | source/blender/depsgraph/intern/builder/deg_builder_map.cc | 23 |
1 files changed, 5 insertions, 18 deletions
diff --git a/source/blender/depsgraph/intern/builder/deg_builder_map.cc b/source/blender/depsgraph/intern/builder/deg_builder_map.cc index 4bca4f037b0..d0bebd8b10a 100644 --- a/source/blender/depsgraph/intern/builder/deg_builder_map.cc +++ b/source/blender/depsgraph/intern/builder/deg_builder_map.cc @@ -42,33 +42,20 @@ bool BuilderMap::checkIsBuilt(ID *id, int tag) const void BuilderMap::tagBuild(ID *id, int tag) { - IDTagMap::iterator it = id_tags_.find(id); - if (it == id_tags_.end()) { - id_tags_.insert(make_pair(id, tag)); - return; - } - it->second |= tag; + id_tags_.lookup_or_add(id, 0) |= tag; } bool BuilderMap::checkIsBuiltAndTag(ID *id, int tag) { - IDTagMap::iterator it = id_tags_.find(id); - if (it == id_tags_.end()) { - id_tags_.insert(make_pair(id, tag)); - return false; - } - const bool result = (it->second & tag) == tag; - it->second |= tag; + int &id_tag = id_tags_.lookup_or_add(id, 0); + const bool result = (id_tag & tag) == tag; + id_tag |= tag; return result; } int BuilderMap::getIDTag(ID *id) const { - IDTagMap::const_iterator it = id_tags_.find(id); - if (it == id_tags_.end()) { - return 0; - } - return it->second; + return id_tags_.lookup_default(id, 0); } } // namespace DEG |