From b9ca395bdade623ccfc58e92a98e90bf7eae6f17 Mon Sep 17 00:00:00 2001 From: vrouvrea Date: Mon, 11 Sep 2017 19:40:56 +0000 Subject: Code review: constify find_child and for instead of while loop git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/branches/graph_expansion_with_blocker_oracle@2657 636b058d-ea47-450e-bf9e-a15bfbe3eedb Former-commit-id: e136c1a8b6d5bbc213383f1e6a2e00a875424ad1 --- src/Simplex_tree/include/gudhi/Simplex_tree.h | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'src/Simplex_tree') diff --git a/src/Simplex_tree/include/gudhi/Simplex_tree.h b/src/Simplex_tree/include/gudhi/Simplex_tree.h index f7df277c..f48dd048 100644 --- a/src/Simplex_tree/include/gudhi/Simplex_tree.h +++ b/src/Simplex_tree/include/gudhi/Simplex_tree.h @@ -1124,9 +1124,8 @@ class Simplex_tree { return; // Reverse loop starting before the last one for 'next' to be the last one for (auto simplex = siblings->members().rbegin() + 1; simplex != siblings->members().rend(); simplex++) { - auto next = siblings->members().rbegin(); std::vector > intersection; - while(next != simplex) { + for(auto next = siblings->members().rbegin(); next != simplex; next++) { bool to_be_inserted = true; Filtration_value filt = simplex->second.filtration(); // If all the boundaries are present, 'next' needs to be inserted @@ -1141,8 +1140,6 @@ class Simplex_tree { if (to_be_inserted) { intersection.emplace_back(next->first, Node(nullptr, filt)); } - // loop until simplex is reached - next++; } if (intersection.size() != 0) { // Reverse the order to insert @@ -1183,7 +1180,7 @@ class Simplex_tree { * Vertex_handle. * Returns null_simplex() if it does not exist */ - Simplex_handle find_child(Simplex_handle sh, Vertex_handle vh) { + Simplex_handle find_child(Simplex_handle sh, Vertex_handle vh) const { if (!has_children(sh)) return null_simplex(); -- cgit v1.2.3