diff --git a/include/yaml-cpp/stlemitter.h b/include/yaml-cpp/stlemitter.h index 06780c8..8dacf97 100644 --- a/include/yaml-cpp/stlemitter.h +++ b/include/yaml-cpp/stlemitter.h @@ -16,8 +16,8 @@ namespace YAML { template inline Emitter& EmitSeq(Emitter& emitter, const Seq& seq) { emitter << BeginSeq; - for (typename Seq::const_iterator it = seq.begin(); it != seq.end(); ++it) - emitter << *it; + for (const auto& emit : seq) + emitter << emit; emitter << EndSeq; return emitter; } @@ -41,8 +41,8 @@ template inline Emitter& operator<<(Emitter& emitter, const std::map& m) { typedef typename std::map map; emitter << BeginMap; - for (typename map::const_iterator it = m.begin(); it != m.end(); ++it) - emitter << Key << it->first << Value << it->second; + for (const auto& emit : m) + emitter << Key << emit.first << Value << emit.second; emitter << EndMap; return emitter; } diff --git a/src/setting.h b/src/setting.h index 1bd3cfe..4960bbf 100644 --- a/src/setting.h +++ b/src/setting.h @@ -83,9 +83,8 @@ class SettingChanges { } void restore() YAML_CPP_NOEXCEPT { - for (setting_changes::const_iterator it = m_settingChanges.begin(); - it != m_settingChanges.end(); ++it) - (*it)->pop(); + for (const auto& setting : m_settingChanges) + setting->pop(); } void push(std::unique_ptr pSettingChange) { diff --git a/test/integration/load_node_test.cpp b/test/integration/load_node_test.cpp index 8186486..33d50b9 100644 --- a/test/integration/load_node_test.cpp +++ b/test/integration/load_node_test.cpp @@ -254,7 +254,7 @@ TEST(NodeTest, IncompleteJson) { {"JSON map without end brace", "{\"access\":\"abc\"", ErrorMsg::END_OF_MAP_FLOW}, }; - for (const ParserExceptionTestCase test : tests) { + for (const ParserExceptionTestCase& test : tests) { try { Load(test.input); FAIL() << "Expected exception " << test.expected_exception << " for "