From 235d820e2cdaee564814c94493bd8273080f991e Mon Sep 17 00:00:00 2001 From: Dmitri Naumov <github@naumov.de> Date: Thu, 13 Aug 2020 09:36:06 +0200 Subject: [PATCH] [BL] Use structured bindings and for-range-loop. --- BaseLib/ConfigTreeUtil.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/BaseLib/ConfigTreeUtil.cpp b/BaseLib/ConfigTreeUtil.cpp index 912d8dfe931..102c3d0b659 100644 --- a/BaseLib/ConfigTreeUtil.cpp +++ b/BaseLib/ConfigTreeUtil.cpp @@ -57,10 +57,10 @@ void traverse_recursive( using boost::property_tree::ptree; method(parent, child_path, child, bench_dir); - for (ptree::iterator it = child.begin(); it != child.end(); ++it) + for (auto& [key, tree] : child) { - ptree::path_type cur_path = child_path / ptree::path_type(it->first); - traverse_recursive(child, cur_path, it->second, bench_dir, method); + ptree::path_type cur_path = child_path / ptree::path_type(key); + traverse_recursive(child, cur_path, tree, bench_dir, method); } } @@ -78,11 +78,11 @@ void replace_includes( const fs::path bench_dir) { using boost::property_tree::ptree; - for (ptree::const_iterator it = child.begin(); it != child.end(); ++it) + for (auto& [key, tree] : child) { - if (it->first == "include") + if (key == "include") { - auto filename = it->second.get<std::string>("<xmlattr>.file"); + auto filename = tree.get<std::string>("<xmlattr>.file"); auto filepath = fs::path(filename); if (filepath.is_relative()) { -- GitLab