manual range loop conversions

Signed-off-by: Rosen Penev <rosenp@gmail.com>
This commit is contained in:
Rosen Penev 2020-06-15 14:40:30 -07:00
parent a62950ed60
commit b789bb009c
No known key found for this signature in database
GPG Key ID: 36D31CFA845F0E3B
3 changed files with 7 additions and 8 deletions

View File

@ -16,8 +16,8 @@ namespace YAML {
template <typename Seq> template <typename Seq>
inline Emitter& EmitSeq(Emitter& emitter, const Seq& seq) { inline Emitter& EmitSeq(Emitter& emitter, const Seq& seq) {
emitter << BeginSeq; emitter << BeginSeq;
for (typename Seq::const_iterator it = seq.begin(); it != seq.end(); ++it) for (const auto& emit : seq)
emitter << *it; emitter << emit;
emitter << EndSeq; emitter << EndSeq;
return emitter; return emitter;
} }
@ -41,8 +41,8 @@ template <typename K, typename V>
inline Emitter& operator<<(Emitter& emitter, const std::map<K, V>& m) { inline Emitter& operator<<(Emitter& emitter, const std::map<K, V>& m) {
typedef typename std::map<K, V> map; typedef typename std::map<K, V> map;
emitter << BeginMap; emitter << BeginMap;
for (typename map::const_iterator it = m.begin(); it != m.end(); ++it) for (const auto& emit : m)
emitter << Key << it->first << Value << it->second; emitter << Key << emit.first << Value << emit.second;
emitter << EndMap; emitter << EndMap;
return emitter; return emitter;
} }

View File

@ -83,9 +83,8 @@ class SettingChanges {
} }
void restore() YAML_CPP_NOEXCEPT { void restore() YAML_CPP_NOEXCEPT {
for (setting_changes::const_iterator it = m_settingChanges.begin(); for (const auto& setting : m_settingChanges)
it != m_settingChanges.end(); ++it) setting->pop();
(*it)->pop();
} }
void push(std::unique_ptr<SettingChangeBase> pSettingChange) { void push(std::unique_ptr<SettingChangeBase> pSettingChange) {

View File

@ -254,7 +254,7 @@ TEST(NodeTest, IncompleteJson) {
{"JSON map without end brace", "{\"access\":\"abc\"", {"JSON map without end brace", "{\"access\":\"abc\"",
ErrorMsg::END_OF_MAP_FLOW}, ErrorMsg::END_OF_MAP_FLOW},
}; };
for (const ParserExceptionTestCase test : tests) { for (const ParserExceptionTestCase& test : tests) {
try { try {
Load(test.input); Load(test.input);
FAIL() << "Expected exception " << test.expected_exception << " for " FAIL() << "Expected exception " << test.expected_exception << " for "