|
Boost : |
Subject: Re: [boost] boost::property_tree is seriously outdated/incomplete
From: Philippe Vaucher (philippe.vaucher_at_[hidden])
Date: 2010-02-18 07:22:21
> I'm the PTree maintainer, and I know I'm not giving it nearly enough
> attention as it needs at this stage. I'll get around to it some day soon.
>
Hi! Thanks for your attention. No worries I know it's easy to get all your
time eaten by other projects.
> As for your suggestions:
> parent() is a no-go, I think. I actually suggested it back when the
> library was first proposed for Boost. I can't remember exactly why the
> author shot it down, but it was a pretty convincing argument. I'll have
> to go dig in the archives.
>
Hum I'd like to hear about it, apparently the tree uses
boost::multi_index_container as its implementation. I'm not sure how hard
it'd be to make it so node creation store a pointer to their parent.
> Setting the default separator is something I'll have to think about.
> That you can't supply a different separator for operations other than
> get() is definitely a bug.
>
Hum sorry I probably missexpressed myself. What I meant is that you have to
specify the separator for each .get()/.put() etc request. The code gets
quickly too verbose:
boost::property_tree::ptree tree;
tree.put(boost::property_tree::ptree::path_type("foo/bar", '/'), 123);
unsigned n =
tree.get<unsigned>(boost::property_tree::ptree::path_type("foo/bar", '/'));
boost::property_tree::ptree& child =
tree.get_child(boost::property_tree::ptree::path_type("foo/bar", '/'));
If one could pass the default separator or pass the path_type to
boost::property_tree::ptree (instead of it being deduced from the key_type),
one could do:
boost::property_tree::ptree tree('/');
tree.put("foo/bar", 123);
unsigned n = tree.get<unsigned>("foo/bar");
boost::property_tree::ptree& child = tree.get_child("foo/bar");
I think most people want to change from '.' to '/' for ALL operations, not
just one specific key...
Thanks!
Philippe
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk