2

サブツリーをあるサブツリーから別のサブツリーにコピーしたいptree
つまり
、src:

<abc>
<question>
--some-subtree--
</question>
</abc>


そして生成します:

<def>
<Version>1</Version>
<QueueQuestion>
--same-subtree-as-above--
</QueueQuestion>
</def>


次のようにします。

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;
}

ただし、セグメンテーション違反が発生しますsubtree.put_child("QueueQuestion",q);

誰かアイデアはありますか?

4

0 に答える 0