$include_dir="/home/hyper-archives/boost/include"; include("$include_dir/msg-header.inc") ?>
From: Jose (jmalv04_at_[hidden])
Date: 2006-04-27 06:56:12
On 4/27/06, Marcin Kalicinski <kalita_at_[hidden]> wrote:
>
> Sort is not stable. But I thing there is a better algorithm: iterate over
> all nodes and compare keys. It is O(n) instead O(n log n), plus it
> preserves
> the sequence of nodes. This will list all the titles:
>
> BOOST_FOREACH(boost::property_tree::ptree::value_type &v, pt.get_child(
> argv[2] ))
> if (v.first == "item")
> std::cout << "title: " << v.second.get("title", "no title") <<
> '\n';
Yes, this is what I was looking for. What I think is missing is a method to
construct the full query path, so that you don't have to code for "item" and
"title" , something like pt.get_match("rss.channel.item.title") . Also, the
fact that it preserves the ordering is important (and performance is less
important in this case)