Closed Compro-Prasad closed 6 years ago
On Fri, Aug 24, 2018 at 2:43 PM Compro Prasad notifications@github.com wrote:
Why does + add a child and not a sibling? It seems more obvious when its added at the same level.
See wbs_impl.cxx, line 60.
ASSERT ((sibling_path.parts_length () != 0), "Sibling path cannot be empty");
Since a sibling can only be added if at least one node is present in the tree.
That leaves us two ways to handle (+):
Way 1: Keep it disable when there is no node in the tree.
Way 2: Use it to add child. Since, child can be added without the assertion check. (Weird, Right ?)
I chose Way 2, because it seems more intuitive that (+) adds a new node, which can only be done via "add_child" at the moment. (for empty tree)
Oh. I get it now.
A question:
Why does
+
add a child and not a sibling? It seems more obvious when its added at the same level.