I've searched a lot through the boost manual, and the internet, as I believe it is quite a standard feature?
Well I'm looking into "merging" property trees. - I noticed the function insert
, and I hope I can merge trees with this?开发者_如何学运维
Below is the line which I am trying to get working:
base.insert(base.get_child("BRANCH"), t);
base
and t
are "property trees", base
has as (one of many) branch "BRANCH". Now I wish to insert t
into this branch?
You can get an iterator to an element using the begin() method:
base.get_child("BRANCH").begin();
In order to insert every element in t on that position, you should use:
base.insert(base.get_child("BRANCH").begin(), t.begin(), t.end());
If t contains one parent node or you only want to insert the first node, you can use:
base.insert(base.get_child("BRANCH").begin(), t.front());
精彩评论