Boost logo

Boost :

From: Baptiste Lepilleur (blepctc_at_[hidden])
Date: 2006-04-24 16:48:20


John Maddock wrote:
> ...
> How about:
>
> mymap b;
> b[a][b][c] = 2; // assigns value 2 to node at a/b/c
>
> The way I'm figuring this would work is:
>
> * Accessing a child node with operator[] always succeeds but may
> point to a "ghost" node that doesn't actually exist.
> * Assignment to a node always succeeds, the node gets created if
> required.
...
> int i = mymap["fee"]["far"]["thumb"].get(3);
>
> returns 3 if there is no data.

Just my 2 cents, this is just how it's implemented it in jsoncpp (which
doesn't even attempt to do half of what the proposed library do):
http://jsoncpp.sourceforge.net/
http://jsoncpp.sourceforge.net/class_json_1_1_value.html

To my knowledge JDOM and TinyXML also provides a similar mecanism.

So you may have put your finger on something,
Baptiste.


Boost list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk