From 0481a0bb69de12de247a837e9a5a50440ae4aaf8 Mon Sep 17 00:00:00 2001 From: Tristan Penman Date: Sun, 28 Jun 2020 12:39:50 +1000 Subject: [PATCH] Minor tidy up of const auto usage --- include/valijson/adapters/property_tree_adapter.hpp | 2 +- include/valijson/validation_visitor.hpp | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/include/valijson/adapters/property_tree_adapter.hpp b/include/valijson/adapters/property_tree_adapter.hpp index 707e1e0..ff18ed6 100644 --- a/include/valijson/adapters/property_tree_adapter.hpp +++ b/include/valijson/adapters/property_tree_adapter.hpp @@ -283,7 +283,7 @@ public: array.emplace(tree); // Treat as empty array } else { bool isArray = true; - for (const auto node : tree) { + for (const auto &node : tree) { if (!node.first.empty()) { isArray = false; break; diff --git a/include/valijson/validation_visitor.hpp b/include/valijson/validation_visitor.hpp index 7b0ee87..ff12e2a 100644 --- a/include/valijson/validation_visitor.hpp +++ b/include/valijson/validation_visitor.hpp @@ -232,8 +232,8 @@ public: const typename AdapterType::Array arr = target.asArray(); bool validated = false; - for (auto itr = arr.begin(); itr != arr.end(); ++itr) { - ValidationVisitor containsValidator(*itr, context, strictTypes, nullptr); + for (const auto &el : arr) { + ValidationVisitor containsValidator(el, context, strictTypes, nullptr); if (containsValidator.validateSchema(*subschema)) { validated = true; break;