summaryrefslogtreecommitdiff
path: root/src/Simplex_tree/include/gudhi/Simplex_tree
diff options
context:
space:
mode:
authorglisse <glisse@636b058d-ea47-450e-bf9e-a15bfbe3eedb>2015-07-11 15:43:50 +0000
committerglisse <glisse@636b058d-ea47-450e-bf9e-a15bfbe3eedb>2015-07-11 15:43:50 +0000
commit8e75cf8acd691c22ca972a5c0c5bf12580af2e78 (patch)
treefae7bd72250f3a0ef379688f9cdda5c696553ec4 /src/Simplex_tree/include/gudhi/Simplex_tree
parent16ff459809374b1d8616a81dda2340c7f3942912 (diff)
Clean-ups
Avoid duplicate search with find+insert. No need to store 0 and 1 and return them by reference. git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/trunk@702 636b058d-ea47-450e-bf9e-a15bfbe3eedb Former-commit-id: 28403136284a9fe2044b9d51bc2f10861b3a09e7
Diffstat (limited to 'src/Simplex_tree/include/gudhi/Simplex_tree')
-rw-r--r--src/Simplex_tree/include/gudhi/Simplex_tree/Simplex_tree_siblings.h14
1 files changed, 4 insertions, 10 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 d6cbacaa..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
@@ -90,18 +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_.emplace(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);
}