From f6f462dac529025f7302cf7aad82d1d3e3ad7ef0 Mon Sep 17 00:00:00 2001 From: dragonmux Date: Tue, 9 Jan 2024 17:32:10 +0000 Subject: [PATCH] command_line/arguments: Switched gatherGlobals() to using std::for_each() --- impl/command_line/arguments.cxx | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/impl/command_line/arguments.cxx b/impl/command_line/arguments.cxx index d5694463..246c29a1 100644 --- a/impl/command_line/arguments.cxx +++ b/impl/command_line/arguments.cxx @@ -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; }