
Martin Adrian wrote:
- Add a 'name()/full_name()' method to the interface; the name() method would return the current tree 'leaf' name and the full_name() returns the complete path from the root. - Add 'parent()' method. - Add support for relative paths; e.g. ptree::get("../sibling/arg")
I think you have misunderstood the implementatation of the ptree. There are no "upward" links in the structure so there is no way for a node to know its parent or root.
Personally I think it would be a good idea to let each node carry parent and/or root information. That way you could store tree-wide information (e.g. separator, locale, source) in the root.
Only downside I can think of is O(N) swap instead of O(1).
That would not be a real swap() and should be called something else. -Thorsten