mirror of
https://github.com/jbeder/yaml-cpp.git
synced 2025-09-09 12:41:17 +00:00
partially fix clang compilation (#893)
* partially fix clang compilation Missing header and mistaken algorithm usage. Also removed it name from range loops. It's not correct. Signed-off-by: Rosen Penev <rosenp@gmail.com> * run through clang's -Wrange-loop-analysis Some range loops should not use references as they need to copy. Signed-off-by: Rosen Penev <rosenp@gmail.com> * manual range loop conversions Signed-off-by: Rosen Penev <rosenp@gmail.com>
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
#include <algorithm>
|
||||
#include <cassert>
|
||||
#include <iterator>
|
||||
#include <sstream>
|
||||
|
@@ -32,13 +32,12 @@ void NodeEvents::Setup(const detail::node& node) {
|
||||
return;
|
||||
|
||||
if (node.type() == NodeType::Sequence) {
|
||||
for (const auto& it : node)
|
||||
Setup(*it);
|
||||
for (auto element : node)
|
||||
Setup(*element);
|
||||
} else if (node.type() == NodeType::Map) {
|
||||
for (detail::const_node_iterator it = node.begin(); it != node.end();
|
||||
++it) {
|
||||
Setup(*it->first);
|
||||
Setup(*it->second);
|
||||
for (auto element : node) {
|
||||
Setup(*element.first);
|
||||
Setup(*element.second);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -77,16 +76,15 @@ void NodeEvents::Emit(const detail::node& node, EventHandler& handler,
|
||||
break;
|
||||
case NodeType::Sequence:
|
||||
handler.OnSequenceStart(Mark(), node.tag(), anchor, node.style());
|
||||
for (const auto& it : node)
|
||||
Emit(*it, handler, am);
|
||||
for (auto element : node)
|
||||
Emit(*element, handler, am);
|
||||
handler.OnSequenceEnd();
|
||||
break;
|
||||
case NodeType::Map:
|
||||
handler.OnMapStart(Mark(), node.tag(), anchor, node.style());
|
||||
for (detail::const_node_iterator it = node.begin(); it != node.end();
|
||||
++it) {
|
||||
Emit(*it->first, handler, am);
|
||||
Emit(*it->second, handler, am);
|
||||
for (auto element : node) {
|
||||
Emit(*element.first, handler, am);
|
||||
Emit(*element.second, handler, am);
|
||||
}
|
||||
handler.OnMapEnd();
|
||||
break;
|
||||
|
@@ -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<SettingChangeBase> pSettingChange) {
|
||||
|
Reference in New Issue
Block a user