|
Boost : |
From: Thorsten Ottosen (thorsten.ottosen_at_[hidden])
Date: 2006-04-22 06:05:19
Matias Capeletto wrote:
> If we get the path into ptree we can overload other operator to support this
> type of path (we can not overload operator[]... because of precedence
> issues :( someone nows a way we can still use it?, the sintaxis will be very
> nice. As i see it, the only the choosen operator must have the same priority,
> see the examples, so we have only have * and % ).
>
> Something like this may work...
>
> ptree data;
> ptree::path p;
>
> data.put( p / "debug" / "info" / "testfail" , "somefile.hpp" );
> data.put( p / "debug" / "info" / "testfail" , "otherfile.hpp" );
> data.put( p / "debug" / "info" / "testfail" , "wer.hpp" );
>
> data.set( p / "debug" / "info" / "testfail" %2 , "file.hpp" ); // we use set!
some simple function would allow you to write
data.set( p / "debug" / "info" / "testfail" / at(2) , "file.hpp" );
or we might say
data.set( (p / "debug" / "info" / "testfail")[2] , "file.hpp" );
or perhaps
data.set( p / "debug" / "info" / "testfail[2]" , "file.hpp" );
-Thorsten
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk