|
Boost : |
Subject: [boost] [property_tree] Conversion constructor missing?
From: Boris (boriss_at_[hidden])
Date: 2008-10-07 19:44:49
Imagine you have this XML structure (copied from the documentation and
shortened):
<debug>
<modules>
<module>Finance</module>
<module>Admin</module>
<module>HR</module>
</modules>
</debug>
Now imagine you have this function which you want to call three times to
pass the <module>...</module> nodes to:
void foo(boost::property_tree::ptree pt);
You can use get_child("debug.modules") to retrieve a property tree
containing all module nodes. However if you iterate over the property tree
the iterator refers to std::pair<const key_type, basic_ptree<Tr>> - and
there is no simple way to convert this pair to a new property tree. You
must create an empty property tree followed by a call to push_back() to
insert the pair. Either there is a conversion constructor missing or I
miss something and there is a simpler way of what I'm trying to do?
Boris
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk