tags:

views:

51

answers:

1

I'm using boost property tree to store configuration data for my application.

In the configuration file I have an item named that looks like this. I'm wondering how I can iterate over the ServerList.

ServerList
{
   server1 127.0.0.1:5000
   server2 example.com
}

By the way the solution provided here, didn't seem to work for me: http://stackoverflow.com/questions/1794418/boost-property-tree-and-xml-parsing-problems So don't go and requote that. When I tried it I got this error:

config.cpp:47: error: invalid initialization of reference of type ‘boost::property_tree::wiptree&’ from expression of type ‘boost::property_tree::basic_ptree<std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::less<std::basic_string<char, std::char_traits<char>, std::allocator<char> > > >’
make: *** [config.o] Error 1
A: 

To answer my own question. The clue is in the error.

I'm using a wiptree here invalid initialization of reference of type ‘boost::property_tree::wiptree& ...

But a basic ptree here type ‘boost::property_tree::basic_ptree ...

Change from wiptree to ptree and it works.

Matt H