Boost logo

Boost :

From: Thorsten Ottosen (thorsten.ottosen_at_[hidden])
Date: 2006-05-22 14:48:51


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


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk