#include <boost/property_tree/ptree.hpp>
#include <string>
#include <iostream>
int main()
{
boost::property_tree::ptree ptree;
const std::string entry = "server.url";
ptree.add( entry, "foo.com" );
auto range = ptree.equal_range( entry );
for( auto iter = range.first ; iter != range.second ; ++iter )
std::cout << iter->first << '\n';
}
我不明白为什么这段代码不打印。由于可能有很多server.url条目,我试图使用equal_range
.