From 78ebd1455188af1b466ce369a81db35534bc37b9 Mon Sep 17 00:00:00 2001 From: beder Date: Mon, 12 Sep 2011 22:05:43 -0500 Subject: [PATCH] Switched Node::operator=(const Node&) to *not* force itself to create its node first (since we're just assigning them) --- include/yaml-cpp/node/impl.h | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/include/yaml-cpp/node/impl.h b/include/yaml-cpp/node/impl.h index f5e7b34..5430b9d 100644 --- a/include/yaml-cpp/node/impl.h +++ b/include/yaml-cpp/node/impl.h @@ -138,9 +138,14 @@ namespace YAML inline void Node::AssignNode(const Node& rhs) { - EnsureNodeExists(); rhs.EnsureNodeExists(); + if(!m_pNode) { + m_pNode = rhs.m_pNode; + m_pMemory = rhs.m_pMemory; + return; + } + m_pNode->set_ref(*rhs.m_pNode); m_pMemory->merge(*rhs.m_pMemory); m_pNode = rhs.m_pNode;