Skip to content

Commit

Permalink
Fix sonar smells
Browse files Browse the repository at this point in the history
Signed-off-by: Sébastien LAIGRE <[email protected]>
  • Loading branch information
sebalaig committed Feb 28, 2022
1 parent 180aa52 commit c46cddb
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
2 changes: 1 addition & 1 deletion include/powsybl/math/UndirectedGraph.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ class UndirectedGraph {

bool traverse(unsigned long v, const Traverser& traverser) const;

bool traverse(stdcxx::const_range<unsigned long>& startingVertices, const Traverser& traverser) const;
bool traverse(const stdcxx::const_range<unsigned long>& startingVertices, const Traverser& traverser) const;

bool traverse(unsigned long v, const Traverser& traverser, std::vector<bool>& encountered) const;

Expand Down
8 changes: 3 additions & 5 deletions include/powsybl/math/UndirectedGraph.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -425,14 +425,12 @@ bool UndirectedGraph<V, E>::traverse(unsigned long v, const Traverser& traverser
}

template <typename V, typename E>
bool UndirectedGraph<V, E>::traverse(stdcxx::const_range<unsigned long>& startingVertices, const Traverser& traverser) const {
bool UndirectedGraph<V, E>::traverse(const stdcxx::const_range<unsigned long>& startingVertices, const Traverser& traverser) const {
std::vector<bool> encountered(m_vertices.size(), false);

for (unsigned long startingVertex : startingVertices) {
if (!encountered[startingVertex]) {
if (!traverse(startingVertex, traverser, encountered)) {
return false;
}
if (!encountered[startingVertex] && !traverse(startingVertex, traverser, encountered)) {
return false;
}
}
return true;
Expand Down

0 comments on commit c46cddb

Please sign in to comment.