From c07246464154e573dfea3d45cea4d00884660c6e Mon Sep 17 00:00:00 2001 From: David Robillard Date: Sun, 6 Oct 2024 16:42:58 -0400 Subject: Use std::count_if() --- src/gui/WindowFactory.cpp | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) (limited to 'src/gui') diff --git a/src/gui/WindowFactory.cpp b/src/gui/WindowFactory.cpp index 4fce885c..802fc016 100644 --- a/src/gui/WindowFactory.cpp +++ b/src/gui/WindowFactory.cpp @@ -1,6 +1,6 @@ /* This file is part of Ingen. - Copyright 2007-2015 David Robillard + Copyright 2007-2024 David Robillard Ingen is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free @@ -36,6 +36,7 @@ #include #include +#include #include #include #include @@ -93,14 +94,9 @@ WindowFactory::clear() size_t WindowFactory::num_open_graph_windows() { - size_t ret = 0; - for (const auto& w : _graph_windows) { - if (w.second->is_visible()) { - ++ret; - } - } - - return ret; + return std::count_if(_graph_windows.begin(), + _graph_windows.end(), + [](const auto& w) { return w.second->is_visible(); }); } GraphBox* -- cgit v1.2.1