I have a simple tree structure stored in XML and use boost::property_tree::ptree
to read and extract the information. I then recreate the tree using std::maps
so that I can store data in the leaves. This works well and I like the separation of the fixed tree structure from the data but I feel that I am duplicating a lot of code and that if I could add a class to each leaf node in the ptree I could greatly simplify my code.
As a possible slight complication I am using boost::variant
in the class I wish to store in the leaves.
My main question is should I try to add dynamic data to the ptree and secondly, if so, do you have any suggestions of the best way to add it.