Skip to content

Commit

Permalink
adjacency_matrix: ::empty function
Browse files Browse the repository at this point in the history
  • Loading branch information
skypjack committed Jan 30, 2024
1 parent c1a211d commit c1b7229
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/entt/graph/adjacency_matrix.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,19 @@ class adjacency_matrix {
swap(vert, other.vert);
}

/**
* @brief Returns true if an adjacency matrix is empty, false otherwise.
*
* @warning
* Potentially expensive, try to avoid it on hot paths.
*
* @return True if the adjacency matrix is empty, false otherwise.
*/
[[nodiscard]] bool empty() const noexcept {
const auto iterable = edges();
return (iterable.begin() == iterable.end());
}

/**
* @brief Returns the number of vertices.
* @return The number of vertices.
Expand Down

0 comments on commit c1b7229

Please sign in to comment.