diff --git a/include/yaml-cpp/node/convert.h b/include/yaml-cpp/node/convert.h index e22044f..bbe0b7d 100644 --- a/include/yaml-cpp/node/convert.h +++ b/include/yaml-cpp/node/convert.h @@ -225,8 +225,8 @@ template struct convert> { static Node encode(const std::map& rhs) { Node node(NodeType::Map); - for (const auto& it : rhs) - node.force_insert(it.first, it.second); + for (const auto& element : rhs) + node.force_insert(element.first, element.second); return node; } @@ -235,12 +235,12 @@ struct convert> { return false; rhs.clear(); - for (const auto& it : node) + for (const auto& element : node) #if defined(__GNUC__) && __GNUC__ < 4 // workaround for GCC 3: - rhs[it.first.template as()] = it.second.template as(); + rhs[element.first.template as()] = element.second.template as(); #else - rhs[it.first.as()] = it.second.as(); + rhs[element.first.as()] = element.second.as(); #endif return true; } @@ -251,7 +251,8 @@ template struct convert> { static Node encode(const std::vector& rhs) { Node node(NodeType::Sequence); - std::copy(rhs.begin(), rhs.end(), std::back_inserter(rhs)); + for (const auto& element : rhs) + node.push_back(element); return node; } @@ -260,12 +261,12 @@ struct convert> { return false; rhs.clear(); - for (const auto& it : node) + for (const auto& element : node) #if defined(__GNUC__) && __GNUC__ < 4 // workaround for GCC 3: - rhs.push_back(it.template as()); + rhs.push_back(element.template as()); #else - rhs.push_back(it.as()); + rhs.push_back(element.as()); #endif return true; } @@ -276,7 +277,8 @@ template struct convert> { static Node encode(const std::list& rhs) { Node node(NodeType::Sequence); - std::copy(rhs.begin(), rhs.end(), std::back_inserter(rhs)); + for (const auto& element : rhs) + node.push_back(element); return node; } @@ -285,12 +287,12 @@ struct convert> { return false; rhs.clear(); - for (const auto& it : node) + for (const auto& element : node) #if defined(__GNUC__) && __GNUC__ < 4 // workaround for GCC 3: - rhs.push_back(it.template as()); + rhs.push_back(element.template as()); #else - rhs.push_back(it.as()); + rhs.push_back(element.as()); #endif return true; } @@ -301,7 +303,9 @@ template struct convert> { static Node encode(const std::array& rhs) { Node node(NodeType::Sequence); - std::copy(rhs.begin(), rhs.end(), std::back_inserter(rhs)); + for (const auto& element : rhs) { + node.push_back(element); + } return node; } diff --git a/include/yaml-cpp/node/detail/impl.h b/include/yaml-cpp/node/detail/impl.h index f8bfe38..a94c7bc 100644 --- a/include/yaml-cpp/node/detail/impl.h +++ b/include/yaml-cpp/node/detail/impl.h @@ -158,7 +158,7 @@ inline node& node_data::get(const Key& key, shared_memory_holder pMemory) { }); if (it != m_map.end()) { - return it->second; + return *it->second; } node& k = convert_to_node(key, pMemory); diff --git a/src/node_data.cpp b/src/node_data.cpp index 13aa43a..38daf88 100644 --- a/src/node_data.cpp +++ b/src/node_data.cpp @@ -1,3 +1,4 @@ +#include #include #include #include