From c673355991afe7de1a6bc964cc09934f6bf1d4cd Mon Sep 17 00:00:00 2001 From: MichelJuillard <michel.juillard@mjui.fr> Date: Wed, 6 Dec 2023 19:07:59 +0100 Subject: [PATCH] more fix for local bindings error --- src/Statement.cc | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/src/Statement.cc b/src/Statement.cc index 42c9b1e4..60513a8a 100644 --- a/src/Statement.cc +++ b/src/Statement.cc @@ -185,12 +185,22 @@ void OptionsList::writeOutputCommon(ostream& output, const string& option_group) const { // NOLINTBEGIN(clang-analyzer-core.CallAndMessage) - for (const auto& [name, val] : options) - std::visit( - [&]<class T>(const T& v) { - if constexpr (is_same_v<T, SymbolListVal>) - v.writeOutput(option_group + "." + name, output); - else + for (const auto &[name, val] : options) + auto name1 = name; + std::visit([&]<class T>(const T &v) + { + if constexpr(is_same_v<T, SymbolListVal>) + v.writeOutput(option_group + "." + name1, output); + else + { + output << option_group << "." << name1 << " = "; + if constexpr(is_same_v<T, NumVal> || is_same_v<T, DateVal>) + output << v; + else if constexpr(is_same_v<T, pair<string, string>>) + output << '[' << v.first << "; " << v.second << ']'; + else if constexpr(is_same_v<T, StringVal>) + output << "'" << v << "'"; + else if constexpr(is_same_v<T, vector<int>>) { output << option_group << "." << name << " = "; if constexpr (is_same_v<T, NumVal> || is_same_v<T, DateVal>) -- GitLab