Reputation: 39
I am trying to configurate my XML file, thanks to Boost::Property_Tree. Chat I want is :
<configuration>
<message>
<first>10</first>
</message>
</configuration>
And what I have is :
<configuration><message>first>10</first></message></configuration>
I found that I had to use
boost::property_tree::xml_writer_settings<char> settings(' ', 1);
write_xml(file, XMLobjectL, std::locale(), settings);
But this doesn't compile. Errors are :
IntelliSense: no instance of "write_xml" matches the argument list argument types are: (const std::string, boost::property_tree::ptree, std::locale, boost::property_tree::xml_parser::xml_writer_settings)
error C2664: 'void boost::property_tree::xml_parser::write_xml(const std::string &,const Ptree &,const std::locale &,const boost::property_tree::xml_parser::xml_writer_settings &)' : cannot convert argument 4 from 'boost::property_tree::xml_parser::xml_writer_settings' to 'const boost::property_tree::xml_parser::xml_writer_settings &'
Do you have any idea ? I am using Boost 1.57.0 and MVSC++ Thank you in advance.
Upvotes: 1
Views: 3353
Reputation: 393164
You need to help overload resolution.
That said, consider using xml_writer_make_settings
:
#include <boost/property_tree/ptree.hpp>
#include <boost/property_tree/xml_parser.hpp>
using namespace boost::property_tree;
int main() {
ptree XMLobjectL;
XMLobjectL.put("configuration.message.first", 10);
write_xml("test.xml", XMLobjectL, std::locale(), xml_writer_make_settings<ptree::key_type>(' ', 1u));
}
Upvotes: 1