diff options
author | vrouvrea <vrouvrea@636b058d-ea47-450e-bf9e-a15bfbe3eedb> | 2017-08-25 13:36:42 +0000 |
---|---|---|
committer | vrouvrea <vrouvrea@636b058d-ea47-450e-bf9e-a15bfbe3eedb> | 2017-08-25 13:36:42 +0000 |
commit | fa0388bc3896f881b35fa6c333ceb0116d3e7fdb (patch) | |
tree | 3bbace89d8c85f8588f92f6f891f85e02f55ea07 /src | |
parent | 3d2b438a5d6c08b84df3aefe4a0753f4f0c3e49c (diff) |
Code review : find_child implementation improvement
git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/branches/graph_expansion_with_blocker_oracle@2632 636b058d-ea47-450e-bf9e-a15bfbe3eedb
Former-commit-id: c4024b5a56b64dd168a5de1422a857ccebd606fb
Diffstat (limited to 'src')
-rw-r--r-- | src/Simplex_tree/include/gudhi/Simplex_tree.h | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/src/Simplex_tree/include/gudhi/Simplex_tree.h b/src/Simplex_tree/include/gudhi/Simplex_tree.h index 88092b3d..aa097a38 100644 --- a/src/Simplex_tree/include/gudhi/Simplex_tree.h +++ b/src/Simplex_tree/include/gudhi/Simplex_tree.h @@ -1189,11 +1189,16 @@ class Simplex_tree { * Returns null_simplex() if it does not exist */ Simplex_handle find_child(Simplex_handle sh, Vertex_handle vh) { - std::vector<Vertex_handle> child = {vh}; - for (auto vertex : simplex_vertex_range(sh)) { - child.push_back(vertex); - } - return find(child); + if (!has_children(sh)) + return null_simplex(); + + Simplex_handle child = sh->second.children()->find(vh); + // Specific case of boost::flat_map does not find, returns boost::flat_map::end() + // in simplex tree we want a null_simplex() + if (child == sh->second.children()->members().end()) + return null_simplex(); + + return child; } public: |