Skip to content

Commit

Permalink
code review: prefer the use of assign_filtration(sh, filt)
Browse files Browse the repository at this point in the history
  • Loading branch information
VincentRouvreau committed Nov 12, 2024
1 parent 38a751f commit 0d500bc
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/Simplex_tree/include/gudhi/Simplex_tree.h
Original file line number Diff line number Diff line change
Expand Up @@ -723,9 +723,9 @@ class Simplex_tree {

/** \brief Returns the extra data stored in a simplex. */
Simplex_data& simplex_data(Simplex_handle sh) {
GUDHI_CHECK(sh != null_simplex(),
std::invalid_argument("Simplex_tree::simplex_data - no data associated to null_simplex"));
return _to_node_it(sh)->second.data();
// Scott Meyers in Effective C++ 3rd Edition. On page 23, Item 3: a non const method can safely call a const one
// Doing it the other way is not safe
return const_cast<Simplex_data&>(std::as_const(*this).simplex_data(sh));
}

/** \brief Returns the extra data stored in a simplex. */
Expand Down Expand Up @@ -2024,7 +2024,7 @@ class Simplex_tree {
if (!(sh->second.filtration() >= max_filt_border_value)) {
// Store the filtration modification information
modified = true;
_to_node_it(sh)->second.assign_filtration(max_filt_border_value);
assign_filtration(sh, max_filt_border_value);
}
};
// Loop must be from the end to the beginning, as higher dimension simplex are always on the left part of the tree
Expand Down

0 comments on commit 0d500bc

Please sign in to comment.