Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8624157
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T07:27:19+00:00 2026-06-12T07:27:19+00:00

I got this code form the boost library. http://www.boost.org/doc/libs/1_42_0/doc/html/boost_propertytree/tutorial.html This is the xml file

  • 0

I got this code form the boost library.
http://www.boost.org/doc/libs/1_42_0/doc/html/boost_propertytree/tutorial.html

This is the xml file they have

<debug>
    <filename>debug.log</filename>
    <modules>
        <module>Finance</module>
        <module>Admin</module>
        <module>HR</module>
    </modules>
    <level>2</level>
</debug>

The code to load these values and print them is

#include <boost/property_tree/ptree.hpp>
#include <boost/property_tree/xml_parser.hpp>
#include <boost/foreach.hpp>
#include <string>
#include <set>
#include <exception>
#include <iostream>

struct debug_settings
{
    std::string m_file;               // log filename
    int m_level;                      // debug level
    std::set<std::string> m_modules;  // modules where logging is enabled
    void load(const std::string &filename);
    void save(const std::string &filename);
};

void debug_settings::load(const std::string &filename)
{

    using boost::property_tree::ptree;
    ptree pt;
    read_xml(filename, pt);
    m_file = pt.get<std::string>("debug.filename");
    m_level = pt.get("debug.level", 0);
    BOOST_FOREACH(ptree::value_type &v, pt.get_child("debug.modules"))
    m_modules.insert(v.second.data());

}

void debug_settings::save(const std::string &filename)
{

    using boost::property_tree::ptree;
    ptree pt;

    pt.put("debug.filename", m_file);

    pt.put("debug.level", m_level);

    BOOST_FOREACH(const std::string &name, m_modules)
    pt.put("debug.modules.module", name,true);

    write_xml(filename, pt);
}

int main()
{
    try
    {
        debug_settings ds;
        ds.load("debug_settings.xml");
        ds.save("debug_settings_out.xml");
        std::cout << "Success\n";
    }
    catch (std::exception &e)
    {
        std::cout << "Error: " << e.what() << "\n";
    }
    return 0;
}

But it gives me an error

/usr/include/boost/property_tree/detail/ptree_implementation.hpp:769: error: request for member ‘put_value’ in ‘tr’, which is of non-class type ‘bool’

Can anyone tell me what I am missing?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T07:27:20+00:00Added an answer on June 12, 2026 at 7:27 am

    Seems they have replaced the put () function … So if I changed the line

    “pt.put(“debug.modules.module”, name,true);”

    to

    “pt.add(“debug.modules.module”, name);”

    it works fine. Thank you.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I got this code from the wordpress <head profile=http://gmpg.org/xfn/11> What does this means? what
I got this html code: <form id = xxx> <ul> <li class = req
I got this code in my submit form <form id=myform action='hello.php' method='GET'> <input type=button
I've got this php code to send the users information from the contact form
So, I've got this code: $(document).ready(function(){ $('form').attr('autocomplete', 'off'); }); It works great for all
got a small problem, this code <form action=<?php echo $_SERVER['PHP_SELF']; ?> method=post> <?php ...
I have a problem. You see, I've got this code (MVC3) @Using Html.BeginForm() @Html.ValidationSummary(True,
So I've got this code and part of it is a form, and ALL
I'm using jquery-ui autocomplete to validate some form inputs. I've got this code :
I got this code $(function(){ $('form.register input[type=text], .search input').ToggleInputValue(); $('#next').click(function() { $('form.register input[type=text]').each(function(index) {

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.