
Something like this may work...
ptree data; ptree::path p;
data.put( p / "debug" / "info" / "testfail" , "somefile.hpp" );
If we're going down that road, Shouldn't
data.put( p/"debug/info/testfail/somefile.hpp" );
be made to work, too?
The instruction "data.put( p/"debug/info/testfail/somefile.hpp" );" have no data, it is only a path and you are using put... i think you wanted to say: ptree::path p('/'); // because by default marcin will continue to use the '.' i think data.put( p / "debug/info/testfail" , "somefile.hpp" ); And yes... you are right this have to work, and this other too: string testName = "testfail"; data.put( p / "debug/info" / testName / "time/hour" , 23 ); And if you not want that the mini parser inside path looks for the '/' because you are a performance freak, you may... ptree::ns_path p; // ns: no separator data.put( p / "debug" / "info" / testName / "time" / "hour" , 23 ); and you force yourself to write this way... this have the advantage that now you can stop worring about a spurius separator in your keys that break them without you noticing it. Thinking of it... it seems that it maybe a little bit error prone to give '.' as a default... and insted be could: ptree::path p; // by default, the keys dont get parsed... it behave as the ns_path ptree::path p('.'); // now the string you passed to the / operator are parsed looking for a '.' ptree::path p('@'); // to parse emails :) I feel it will save us from some surprises...