I wrote the following code.
// Add General config
pt::ptree propset1;
propset1.put("propset1.prop1", 2);
propset1.put("propset1.prop2", 5);
propset1.put("propset1.prop3", 60);
propset1.put("propset1.prop4", 7);
// Add childset1 config
pt::ptree childset1;
childset1.add("child1prop1", 4);
childset1.add("child1prop2", 6);
childset1.add("child1prop3", 9);
propset1.add_child("childset1", childset1);
// Add childset2 config
pt::ptree childset2;
childset2.add("child2prop1", 2);
childset2.add("child2prop2", 6);
childset2.add("child2prop3", 7);
propset1.add_child("childset2", childset2);
However the above code is resulting into below property tree.
propset1
{
prop1 2
prop2 5
prop3 60
prop4 5
childset1
{
child1prop1 4
child1prop1 6
child1prop1 9
}
}
propset1
{
prop1 2
prop2 5
prop3 60
prop4 5
childset2
{
child2prop1 2
child2prop1 6
child2prop1 7
}
}
Can someone please suggest what is correct use of API?