Open ranchmed opened 4 years ago
Hi Mark! My memory of some design decisions is a bit rusty (I wrote this 10 years ago) but IIRC this is a consequence of some assymetries from trying to support a tree<>
that could be either empty or have one root element. In more modern FP parlance it's really the analog of something like scala Option[T]
acting like a sequence that is either empty or has one element.
It's slightly hinky under the hood, but I think it might be well defined to have tree<> return begin/end in either the empty or non empty case.
I see this has been open nearly a year :grimacing:
However, I'm going to leave this open in the event that either I have the bandwidth to work on it, or someone else wants to contribute an implementation.
I am thinking about using st_tree on a new project, and have been doing some preliminary testing.
I have one question about obtaining a pointer to the root node to help me construct a tree using node_type iterators.
In an earlier issue, you commented that you could get a node_type iterator from the tree by doing:
Upon execution, I get an empty tree exception. This makes sense as the insert is done after the root() is dereferenced.
I can make it work by inserting a placeholder as follows:
But then we have an extra ply that really isn't part of the tree.
Is there another way to insert a root node in a tree, and then to get an node_type iterator for that node?
Thanks, Mark