Skip to content

Commit

Permalink
get_visible_count() uses now std::count_if()
Browse files Browse the repository at this point in the history
  • Loading branch information
ebasconp committed Sep 24, 2024
1 parent 9aa1ced commit 17f0290
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions code/classeine-lib/clsn/ui/container.h
Original file line number Diff line number Diff line change
Expand Up @@ -216,15 +216,12 @@ namespace clsn::ui
/// @return The count of visible controls.
auto get_visible_count() const -> int
{
auto count = 0;

for (auto& c : get_controls())
{
if (c.is_visible())
count++;
}

return count;
return std::count_if(m_elements.cbegin(), m_elements.cend(),
[this](const ElementType& e) -> bool
{
return to_control(e).is_visible();
}
);
}

/// @brief Loads default settings for the container and its controls.
Expand Down

0 comments on commit 17f0290

Please sign in to comment.