ROSE
0.11.96.11
|
An edge from a parent to a child.
An edge is the inter-node link between a parent node and a child node. The ChildEdge type is only allowed for data members of a Node and is how the node defines which data members participate as edges in the tree.
To create a node and define that it points to two child nodes, one must declare the two child pointers using the ChildEdge type, and then initialize the parent end of the edges during construction, as follows:
It is also possible to give non-null values to the child ends of the edges during construction:
The ChildEdge members are used as if they were pointers:
#include <Tree.h>
Public Member Functions | |
ChildEdge (Node *container) | |
Points to no child. | |
ChildEdge (Node *container, const std::shared_ptr< T > &child) | |
Constructor that points to a child. | |
ChildEdge (const ChildEdge &)=delete | |
ChildEdge & | operator= (const std::shared_ptr< T > &child) |
Point to a child node. | |
void | reset () |
Cause this edge to point to no child. | |
std::shared_ptr< T > | operator-> () const |
Obtain shared pointer. | |
T & | operator* () const |
Obtain pointed-to node. | |
operator bool () const | |
Conversion to bool. | |
std::shared_ptr< T > | shared () const |
Pointer to the child. | |
operator std::shared_ptr< T > () const | |
Implicit conversion to shared pointer. | |