I want to copy a subtree from one ptree
to another.
i.e.
src:
<abc>
<question>
--some-subtree--
</question>
</abc>
and generate:
<def>
<Version>1</Version>
<QueueQuestion>
--same-subtree-as-above--
</QueueQuestion>
</def>
do something like:
ptree genReply(const ptree &pt)
{
ptree ret;
ret.put("def","");
ptree &subtree=ret.find("def")->second;
subtree.put("Version",1);
...
...
...
const Xml::ptree &q=pt.find("abc.Question")->second;
subtree.put_child("QueueQuestion",q);
...
...
return ret;
}
However, I get a segmentation fault on subtree.put_child("QueueQuestion",q);
Any idea anyone?