mirror of
https://github.com/JGRennison/OpenTTD-patches.git
synced 2024-11-11 13:10:45 +00:00
Codechange: Use std::any_of() (#10830)
When the result of std::find_if is compared only with end() then '!= end()' is replaced with any_of(). Just... there's only one.
This commit is contained in:
parent
199e41c762
commit
e4fd9d41d3
@ -144,8 +144,7 @@ private:
|
|||||||
this->indents.push_back(indent);
|
this->indents.push_back(indent);
|
||||||
if (g->folded) {
|
if (g->folded) {
|
||||||
/* Test if this group has children at all. If not, the folded flag should be cleared to avoid lingering unfold buttons in the list. */
|
/* Test if this group has children at all. If not, the folded flag should be cleared to avoid lingering unfold buttons in the list. */
|
||||||
auto child = std::find_if(source.begin(), source.end(), [g](const Group *child){ return child->parent == g->index; });
|
bool has_children = std::any_of(source.begin(), source.end(), [g](const Group *child){ return child->parent == g->index; });
|
||||||
bool has_children = child != source.end();
|
|
||||||
Group::Get(g->index)->folded = has_children;
|
Group::Get(g->index)->folded = has_children;
|
||||||
} else {
|
} else {
|
||||||
AddChildren(source, g->index, indent + 1);
|
AddChildren(source, g->index, indent + 1);
|
||||||
|
Loading…
Reference in New Issue
Block a user