Boost logo

Boost :

Subject: [boost] help with boost::property_tree erasing nested entries please
From: Bernd Prager (bernd_at_[hidden])
Date: 2011-10-03 10:52:05


I would appreciate some help with erasing a nested node entry in
Below is my example. (2) works, but only erases an entire tree. (1)
doesn't but it's really what I want.

Thank you for any help. (I'm sorry, the documentation is not very
verbose on this topic.)

-- Bernd

#include <iostream>
#include <string>

#include <boost/property_tree/ptree.hpp>

using namespace std;
namespace pt = boost::property_tree;

int main(void) {
    pt::ptree props;

    props.put("", "Sesame");
    props.put("", "Ali Baba");
    cout << props.erase("") << " children erased. " << endl;
    // (1)
    cout << props.erase("db")<< " children erased. " << endl; // (2)


Boost list run by bdawes at, gregod at, cpdaniel at, john at