Skip to content

Commit

Permalink
command_line/arguments: Switched gatherGlobals() to using std::for_ea…
Browse files Browse the repository at this point in the history
…ch()
  • Loading branch information
dragonmux committed Jan 9, 2024
1 parent 31ce9ec commit f6f462d
Showing 1 changed file with 15 additions and 10 deletions.
25 changes: 15 additions & 10 deletions impl/command_line/arguments.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -363,18 +363,23 @@ namespace substrate::commandLine
// Clone the existing set of global options
auto result{globalOptions};
// Loop through the current level's options and pull out any that are global
for (const auto &option : options)
{
std::visit(match_t
std::for_each
(
options.begin(),
options.end(),
[&](const internal::optionsItem_t &option)
{
[&](const option_t &value)
std::visit(match_t
{
if (value.isGlobal())
result.insert(value);
},
[&](const optionSet_t &) { },
}, option);
}
[&](const option_t &value)
{
if (value.isGlobal())
result.insert(value);
},
[&](const optionSet_t &) { },
}, option);
}
);
// Having gathered all of them up, return the new set
return result;
}
Expand Down

0 comments on commit f6f462d

Please sign in to comment.