diff options
author | anmoreau <anmoreau@636b058d-ea47-450e-bf9e-a15bfbe3eedb> | 2015-08-18 14:47:50 +0000 |
---|---|---|
committer | anmoreau <anmoreau@636b058d-ea47-450e-bf9e-a15bfbe3eedb> | 2015-08-18 14:47:50 +0000 |
commit | 57fecbe5a89aa4db82ae9cd071966a4201e03463 (patch) | |
tree | de44afecc96879e8c046ae81d8073a5af2492448 /src/Simplex_tree/include/gudhi/Simplex_tree | |
parent | 25f3818f7588b278ea88818dc0a0e4912b28e67d (diff) |
Multiple fixes
git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/branches/copy_move@742 636b058d-ea47-450e-bf9e-a15bfbe3eedb
Former-commit-id: 89e8ccf59283c5775db2f058bf5439bd487d79aa
Diffstat (limited to 'src/Simplex_tree/include/gudhi/Simplex_tree')
-rw-r--r-- | src/Simplex_tree/include/gudhi/Simplex_tree/Simplex_tree_siblings.h | 23 |
1 files changed, 8 insertions, 15 deletions
diff --git a/src/Simplex_tree/include/gudhi/Simplex_tree/Simplex_tree_siblings.h b/src/Simplex_tree/include/gudhi/Simplex_tree/Simplex_tree_siblings.h index 977fafa1..de350f2d 100644 --- a/src/Simplex_tree/include/gudhi/Simplex_tree/Simplex_tree_siblings.h +++ b/src/Simplex_tree/include/gudhi/Simplex_tree/Simplex_tree_siblings.h @@ -77,8 +77,8 @@ class Simplex_tree_siblings { parent_(parent), members_(boost::container::ordered_unique_range, members.begin(), members.end()) { - for (auto map_it = members_.begin(); map_it != members_.end(); map_it++) { - map_it->second.assign_children(this); + for (auto& map_el : members_) { + map_el.second.assign_children(this); } } @@ -90,19 +90,12 @@ class Simplex_tree_siblings { * present in the node. */ void insert(Vertex_handle v, Filtration_value filtration_value) { - typename Dictionary::iterator sh = members_.find(v); - if (sh != members_.end() && sh->second.filtration() > filtration_value) { - sh->second.assign_filtration(filtration_value); - return; - } - if (sh == members_.end()) { - members_.insert( - std::pair<Vertex_handle, Node>(v, Node(this, filtration_value))); - return; - } + auto ins = members_.emplace(v, Node(this, filtration_value)); + if (!ins.second && filtration(ins.first) > filtration_value) + ins.first->second.assign_filtration(filtration_value); } - typename Dictionary::iterator find(Vertex_handle v) { + Dictionary_it find(Vertex_handle v) { return members_.find(v); } @@ -110,7 +103,7 @@ class Simplex_tree_siblings { return oncles_; } - Vertex_handle parent() { + Vertex_handle parent() const { return parent_; } @@ -118,7 +111,7 @@ class Simplex_tree_siblings { return members_; } - size_t size() { + size_t size() const { return members_.size(); } |