
John Maddock wrote:
Let's start with child access, I can't believe you're not using operator[] here. Yes I know it's cute, but it does work well for std::map.
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. * Reading from a node throws if the node doesn't exist yet, or if the conversion can't be performed. * If you read a Boost::optional then it shouldn't throw, and no need for a special member function.
I'm assuming that operator [] returns another "property map" by value BTW.
Seems both expensive (unless state is shared using intrisive_ptr), and impossible, since the returned instance would not know how to change the original instance. Are you sure you don't mean "by reference", perhaps overloaded on const-ness? -Thorsten